- using R version 4.3.3 (2024-02-29 ucrt)
- using platform: x86_64-w64-mingw32 (64-bit)
- R was compiled by
gcc.exe (GCC) 12.3.0
GNU Fortran (GCC) 12.3.0
- running under: Windows Server 2022 x64 (build 20348)
- using session charset: UTF-8
- checking for file 'glmMisrep/DESCRIPTION' ... OK
- checking extension type ... Package
- this is package 'glmMisrep' version '0.1.1'
- package encoding: UTF-8
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking whether package 'glmMisrep' can be installed ... OK
See the install log for details.
- checking installed package size ... OK
- checking package directory ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking R files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... [0s] OK
- checking whether the package can be loaded with stated dependencies ... [0s] OK
- checking whether the package can be unloaded cleanly ... [0s] OK
- checking whether the namespace can be loaded with stated dependencies ... [0s] OK
- checking whether the namespace can be unloaded cleanly ... [1s] OK
- checking loading without being on the library search path ... [0s] OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [14s] OK
- checking Rd files ... [1s] OK
- checking Rd metadata ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking contents of 'data' directory ... OK
- checking data for non-ASCII characters ... [0s] OK
- checking LazyData ... OK
- checking data for ASCII and uncompressed saves ... OK
- checking examples ... [14s] OK
- checking for unstated dependencies in 'tests' ... OK
- checking tests ... [14s] ERROR
Running 'LN-testing.R' [2s]
Running 'NB-testing.R' [2s]
Running 'Norm-testing.R' [1s]
Running 'Pois-testing.R' [4s]
Running 'gamma-testing.R' [4s]
Running the tests in 'tests/Pois-testing.R' failed.
Complete output:
> require(glmMisrep)
Loading required package: glmMisrep
>
> data <- data.frame( Y = c(0, 0, 2, 0, 3, 0, 36, 0, 2, 1, 0, 2, 6, 9, 0, 0, 0, 0, 7, 1, 1, 2, 50, 4, 0, 0, 0, 1,
+ 0, 0, 0, 3, 0, 0, 1, 0, 1, 3, 176, 0, 0, 0, 0, 0, 2, 286, 0, 0, 0, 18),
+ X1 = c(0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1),
+ X2 = c(1.71870212, -0.55840901, 1.22589915, 0.53000107, 0.62571132, 0.02873955, 0.30989954, 1.35514993, 0.15587503,
+ 0.27987513, 0.48892178, 0.35218767, 0.52382778, 1.58126751, -0.07855081, -0.57128802, -0.92500953, -2.48543328,
+ 0.03810910, 0.39929906, -0.54854763, -0.10505694, 0.45120734, 0.32295222, -0.68595918, -0.66892486, 1.72253431,
+ -0.28425276, -0.67719912, -0.39644260, -0.16843500, 0.90540261, -1.38574804, 0.14456841, 0.44142810, -1.89442541,
+ -0.65961894, 2.13148776, 1.72410805, -1.60207312, -1.09525034, -1.31327168, -0.43378445, 1.33644956, 1.28938359,
+ 0.90232362, -0.94112768, -0.61851917, 0.37033085, -0.47019541),
+ X3 = c(0.6882029, 0.9934165, 0.9173388, 0.9406660, 0.5130041, 0.8590187, 0.4468488, 0.4186652, 0.5098278, 0.3339481, 0.6922477,
+ 0.6793977, 0.4983724, 0.6079911, 0.7763041, 0.8529067, 0.8287771, 0.9125900, 0.4802076, 0.8981448, 0.3570093, 0.9209584,
+ 0.4353817, 0.9426418, 0.9550002, 0.4869851, 0.9560156, 0.8247537, 0.1939687, 0.6103839, 0.7721900, 0.5980044, 0.8683831,
+ 0.7004518, 0.8577210, 0.3576712, 0.9540088, 0.9880046, 0.4304899, 0.7416618, 0.6656063, 0.8920356, 0.6097593, 0.8008748,
+ 0.8110432, 0.5967969, 0.6983106, 0.9471680, 0.9929186, 0.9059200),
+ Sex = c("Female", "Male", "Male", "Female", "Male", "Female", "Male", "Male", "Female", "Female", "Male", "Male",
+ "Male", "Female", "Male", "Male", "Female", "Female", "Male", "Female", "Female", "Male", "Female", "Male",
+ "Male", "Male", "Male", "Female", "Female", "Female", "Male", "Male", "Male", "Male", "Female", "Female",
+ "Female", "Female", "Male", "Male", "Male", "Male", "Male", "Male", "Female", "Male", "Male", "Female",
+ "Female", "Male"),
+ Race = c("Black", "White", "White", "White", "White", "White", "Black", "Black", "Black", "Black", "Black", "Black", "White", "Other",
+ "Black", "White", "Black", "White", "Other", "Black", "White", "Other", "Other", "White", "White", "White", "Black", "Other",
+ "White", "Other", "White", "Black", "Other", "Black", "Other", "Other", "Other", "Black", "Other", "Black", "White", "Other",
+ "Black", "White", "Black", "Other", "White", "Black", "Black", "Other"),
+ V_star = c(0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0))
>
> data$Race <- as.factor(data$Race)
> data$Sex <- as.factor(data$Sex)
>
> t1 <- tryCatch(poisRegMisrepEM(formula = y ~ X1 + X2 + X3 + Sex + Race + V_star,
+ v_star = "V_star",
+ data = data,
+ lambda = c(0.6,0.4),
+ epsilon = 1e-08,
+ maxit = 10000,
+ maxrestarts = 20),
+ error = function(x) x )
>
> # The response above is inappropriately specified (y, not Y)
> stopifnot(
+ t1$message == "object 'y' not found"
+ )
>
>
> t2 <- tryCatch(poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race + V_star,
+ v_star = "V_Star",
+ data = data,
+ lambda = c(0.6,0.4),
+ epsilon = 1e-08,
+ maxit = 10000,
+ maxrestarts = 20),
+ error = function(x) x )
>
> # Argument to 'v_star' is misspelled
> stopifnot(
+ t2$message == "variable V_Star not present in dataframe"
+ )
>
>
> data$V_star <- ifelse(data$V_star == 1, yes = "yes", no = "no")
>
> t3 <- tryCatch(poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race + V_star,
+ v_star = "V_star",
+ data = data,
+ lambda = c(0.6,0.4),
+ epsilon = 1e-08,
+ maxit = 10000,
+ maxrestarts = 20),
+ error = function(x) x )
>
>
> # v* variable is type character (yes and no)
> stopifnot(
+ t3$message == "v_star variable must be of class 'factor' or 'numeric'"
+ )
>
> data$V_star <- ifelse(data$V_star == "yes", yes = 1, no = 0)
>
>
> data$V_star[10] <- -1
>
>
> t4 <- tryCatch(poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race + V_star,
+ v_star = "V_star",
+ data = data,
+ lambda = c(0.6,0.4),
+ epsilon = 1e-08,
+ maxit = 10000,
+ maxrestarts = 20),
+ error = function(x) x )
>
> # v* variable must be binary
> stopifnot(
+ t4$message == "v_star variable must contain two unique values"
+ )
>
> data$V_star[10] <- 0
>
>
> data$V_star <- ifelse(data$V_star == 1, yes = 1, no = 2)
>
> t5 <- tryCatch(poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race + V_star,
+ v_star = "V_star",
+ data = data,
+ lambda = c(0.6,0.4),
+ epsilon = 1e-08,
+ maxit = 10000,
+ maxrestarts = 20),
+ error = function(x) x )
>
> # v* must be binary, but more specifically 0/1;
> stopifnot(
+ t5$message == "v_star variable must be coded with ones and zeroes"
+ )
>
>
>
> data$V_star <- ifelse(data$V_star == 1, yes = 1, no = 0)
>
> t6 <- tryCatch(poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race + V_star,
+ v_star = "V_star",
+ data = data,
+ lambda = c(0.49, 0.52),
+ epsilon = 1e-08,
+ maxit = 10000,
+ maxrestarts = 20),
+ error = function(x) x )
>
> # Inappropriately specified lambda argument
> stopifnot(
+ t6$message == "Lambda vector must sum to one"
+ )
>
>
> t7 <- tryCatch(poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race + V_star,
+ v_star = "V_star",
+ data = data,
+ lambda = c(1/3, 1/3, 1/3),
+ epsilon = 1e-08,
+ maxit = 10000,
+ maxrestarts = 20),
+ error = function(x) x )
>
> # Inappropriately specified lambda argument
> stopifnot(
+ t7$message == "Lambda vector must contain two elements"
+ )
>
>
>
> data$X4 <- data$X2*0.3
>
> t8 <- tryCatch(poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + X4 + Sex + Race + V_star,
+ v_star = "V_star",
+ data = data,
+ lambda = c(0.6, 0.4),
+ epsilon = 1e-08,
+ maxit = 10000,
+ maxrestarts = 20),
+ error = function(x) x )
>
> # Linearly dependent covariates/degenerate design matrix
> stopifnot(
+ t8$message == "Linear dependencies exist in the covariates"
+ )
>
>
> t9 <- tryCatch(poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race,
+ v_star = "V_star",
+ data = data,
+ lambda = c(0.6, 0.4),
+ epsilon = 1e-08,
+ maxit = 10000,
+ maxrestarts = 20),
+ error = function(x) x )
>
> #V_star variable absent from formula
> stopifnot(
+ t9$message == "v_star variable must be specified in 'formula'"
+ )
>
>
>
> # EM algorithm should fail to converge within the specified number of attempts
> t10 <- tryCatch(
+ capture.output(poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race + V_star,
+ v_star = "V_star",
+ data = data,
+ lambda = c(0.6, 0.4),
+ epsilon = 1e-08,
+ maxit = 2,
+ maxrestarts = 1)),
+ error = function(x) x
+ )
>
> stopifnot(
+ t10$message == "NOT CONVERGENT! Failed to converge after 1 attempts"
+ )
>
>
> # On the first attempt, fails to converge, and restarts with new mixing props.
> # Succeeds on the second attempt.
> msg <- capture.output(
+ t11 <- poisRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race + V_star,
+ v_star = "V_star",
+ data = data,
+ lambda = c(0.6, 0.4),
+ epsilon = 1e-08,
+ maxit = 16,
+ maxrestarts = 4, verb = TRUE),
+ type = "message"
+ )
Execution halted
- checking PDF version of manual ... [17s] OK
- checking HTML version of manual ... [2s] OK
- DONE
Status: 1 ERROR