- 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 ... [0s] 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 ... [13s] ERROR
Running 'LN-testing.R' [2s]
Running 'NB-testing.R' [3s]
Running 'Norm-testing.R' [1s]
Running 'Pois-testing.R' [2s]
Running 'gamma-testing.R' [4s]
Running the tests in 'tests/NB-testing.R' failed.
Complete output:
> require(glmMisrep)
Loading required package: glmMisrep
>
> data <- data.frame( Y = c(0, 0, 0, 0, 0, 5, 1, 0, 0, 0, 4, 2, 3, 3, 29, 0, 0, 12, 0, 6, 0, 0, 0, 1, 3, 17, 0, 25, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 4, 2, 16, 0, 19, 0, 0, 2, 0, 0, 0, 0, 0),
+ X1 = c(0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
+ 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0),
+ X2 = c(0.315223940, 0.203016819, -0.046615492, -0.040681413, 0.617273624, 0.813577139, 0.434980275, -1.868117146,
+ -0.027052575, 0.228288655, 1.380955283, 0.257543733, -0.353957121, 0.818737902, 0.525026487, -0.506164644,
+ -0.949480806, -0.107608844, 0.363661818, -0.295835692, 0.110056356, -0.205246487, -0.285092978, -0.639260383,
+ 1.576928404, 2.058907651, 0.823073891, -0.340826703, -1.324805151, 0.103545160, 0.497766445, 0.501280218,
+ -0.297921410, 1.056264736, -0.767076814, -0.212290592, -1.563216428, 1.026954673, -0.087597819, 1.334059105,
+ 0.955057522, 1.823380042, 1.082772308, -2.223962848, 1.433183408, -0.004531971, -1.029210193, 0.532295431,
+ -0.930908683, 0.391930241),
+ X3 = c(0.74306067, 0.67595394, 0.96320251, 0.57668303, 0.81643636, 0.78038200, 0.49999395, 0.99676766, 0.97642715, 0.88478779,
+ 0.53447733, 0.27009525, 0.64544670, 0.63666898, 0.14489153, 0.89359811, 0.70506987, 0.81595152, 0.78411313, 0.90301090,
+ 0.48920726, 0.75707194, 0.98999417, 0.85091229, 0.29074286, 0.73562357, 0.97903729, 0.96906234, 0.84957226, 0.55937779,
+ 0.49149558, 0.83789430, 0.66902416, 0.44173571, 0.81911265, 0.64182433, 0.34363554, 0.78838686, 0.78557154, 0.83241653,
+ 0.68691255, 0.20317013, 0.78619988, 0.09229911, 0.52779899, 0.79314940, 0.95612951, 0.95234203, 0.54259470, 0.81656990),
+ Sex = c("Male", "Male", "Female", "Male", "Male", "Female", "Female", "Female", "Female", "Male", "Male", "Female",
+ "Male", "Female", "Male", "Female", "Female", "Male", "Female", "Male", "Male", "Female", "Male", "Female",
+ "Female", "Male", "Male", "Male", "Male", "Female", "Male", "Female", "Female", "Female", "Male", "Female",
+ "Male", "Female", "Male", "Female", "Female", "Male", "Female", "Male", "Male", "Female", "Female", "Female",
+ "Female", "Male"),
+ Race = c("Black", "Black", "White", "White", "White", "White", "Black", "Other", "Other", "Other", "Black", "Other", "Other", "Other", "Other", "Other", "White", "Other",
+ "White", "Black", "White", "Other", "White", "White", "Other", "Other", "Black", "Other", "Other", "Black", "Black", "Black", "Other", "Black", "Black", "Other",
+ "White", "Other", "White", "White", "Other", "Other", "Other", "White", "White", "Black", "Black", "Black", "Other", "White"),
+ V_star = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
>
> data$Race <- as.factor(data$Race)
> data$Sex <- as.factor(data$Sex)
>
> t1 <- tryCatch(nbRegMisrepEM(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(nbRegMisrepEM(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(nbRegMisrepEM(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(nbRegMisrepEM(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(nbRegMisrepEM(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(nbRegMisrepEM(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(nbRegMisrepEM(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(nbRegMisrepEM(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"
+ )
>
> # This is only to make sure the glm.nb() function can fit a model
> # without throwing warnings messages/failing to converge. For purposes
> # of testing our error handling, this should work.
>
> data$VS <- data$V_star
>
> t9 <- tryCatch(nbRegMisrepEM(formula = Y ~ X1 + X2 + X3 + Sex + Race + VS,
+ 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 is absent from formula ragument
> 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(nbRegMisrepEM(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 <- nbRegMisrepEM(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 = 9,
+ 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