Package check result: NOTE Check: CRAN incoming feasibility, Result: NOTE Maintainer: ‘Terry M Therneau ’ Size of tarball: 9413443 bytes Changes to worse in reverse depends: Package: AER Check: examples New result: ERROR Running examples in ‘AER-Ex.R’ failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: PSID1976 > ### Title: Labor Force Participation Data > ### Aliases: PSID1976 > ### Keywords: datasets > > ### ** Examples > > ## Don't show: > if(!requireNamespace("sampleSelection")) { + if(interactive() || is.na(Sys.getenv("_R_CHECK_PACKAGE_NAME_", NA))) { + stop("not all packages required for the example are installed") + } else q() } > ## End(Don't show) > ## data and transformations > data("PSID1976") > PSID1976$kids <- with(PSID1976, factor((youngkids + oldkids) > 0, + levels = c(FALSE, TRUE), labels = c("no", "yes"))) > PSID1976$nwincome <- with(PSID1976, (fincome - hours * wage)/1000) > PSID1976$partnum <- as.numeric(PSID1976$participation) - 1 > > ################### > ## Greene (2003) ## > ################### > > ## Example 4.1, Table 4.2 > ## (reproduced in Example 7.1, Table 7.1) > gr_lm <- lm(log(hours * wage) ~ age + I(age^2) + education + kids, + data = PSID1976, subset = participation == "yes") > summary(gr_lm) Call: lm(formula = log(hours * wage) ~ age + I(age^2) + education + kids, data = PSID1976, subset = participation == "yes") Residuals: Min 1Q Median 3Q Max -4.5305 -0.5266 0.3003 0.8474 1.7568 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.2400965 1.7674296 1.833 0.06747 . age 0.2005573 0.0838603 2.392 0.01721 * I(age^2) -0.0023147 0.0009869 -2.345 0.01947 * education 0.0674727 0.0252486 2.672 0.00782 ** kidsyes -0.3511952 0.1475326 -2.380 0.01773 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.19 on 423 degrees of freedom Multiple R-squared: 0.041, Adjusted R-squared: 0.03193 F-statistic: 4.521 on 4 and 423 DF, p-value: 0.001382 > vcov(gr_lm) (Intercept) age I(age^2) education kidsyes (Intercept) 3.12380756 -1.440901e-01 1.661740e-03 -9.260920e-03 2.674867e-02 age -0.14409007 7.032544e-03 -8.232369e-05 5.085495e-05 -2.641203e-03 I(age^2) 0.00166174 -8.232369e-05 9.739279e-07 -4.976114e-07 3.841018e-05 education -0.00926092 5.085495e-05 -4.976114e-07 6.374903e-04 -5.461931e-05 kidsyes 0.02674867 -2.641203e-03 3.841018e-05 -5.461931e-05 2.176587e-02 > > ## Example 4.5 > summary(gr_lm) Call: lm(formula = log(hours * wage) ~ age + I(age^2) + education + kids, data = PSID1976, subset = participation == "yes") Residuals: Min 1Q Median 3Q Max -4.5305 -0.5266 0.3003 0.8474 1.7568 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.2400965 1.7674296 1.833 0.06747 . age 0.2005573 0.0838603 2.392 0.01721 * I(age^2) -0.0023147 0.0009869 -2.345 0.01947 * education 0.0674727 0.0252486 2.672 0.00782 ** kidsyes -0.3511952 0.1475326 -2.380 0.01773 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.19 on 423 degrees of freedom Multiple R-squared: 0.041, Adjusted R-squared: 0.03193 F-statistic: 4.521 on 4 and 423 DF, p-value: 0.001382 > ## or equivalently > gr_lm1 <- lm(log(hours * wage) ~ 1, data = PSID1976, subset = participation == "yes") > anova(gr_lm1, gr_lm) Analysis of Variance Table Model 1: log(hours * wage) ~ 1 Model 2: log(hours * wage) ~ age + I(age^2) + education + kids Res.Df RSS Df Sum of Sq F Pr(>F) 1 427 625.08 2 423 599.46 4 25.625 4.5206 0.001382 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > ## Example 21.4, p. 681, and Tab. 21.3, p. 682 > gr_probit1 <- glm(participation ~ age + I(age^2) + I(fincome/10000) + education + kids, + data = PSID1976, family = binomial(link = "probit") ) > gr_probit2 <- glm(participation ~ age + I(age^2) + I(fincome/10000) + education, + data = PSID1976, family = binomial(link = "probit")) > gr_probit3 <- glm(participation ~ kids/(age + I(age^2) + I(fincome/10000) + education), + data = PSID1976, family = binomial(link = "probit")) > ## LR test of all coefficients > lrtest(gr_probit1) Likelihood ratio test Model 1: participation ~ age + I(age^2) + I(fincome/10000) + education + kids Model 2: participation ~ 1 #Df LogLik Df Chisq Pr(>Chisq) 1 6 -490.85 2 1 -514.87 -5 48.051 3.468e-09 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > ## Chow-type test > lrtest(gr_probit2, gr_probit3) Likelihood ratio test Model 1: participation ~ age + I(age^2) + I(fincome/10000) + education Model 2: participation ~ kids/(age + I(age^2) + I(fincome/10000) + education) #Df LogLik Df Chisq Pr(>Chisq) 1 5 -496.87 2 10 -489.48 5 14.774 0.01137 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > ## equivalently: > anova(gr_probit2, gr_probit3, test = "Chisq") Analysis of Deviance Table Model 1: participation ~ age + I(age^2) + I(fincome/10000) + education Model 2: participation ~ kids/(age + I(age^2) + I(fincome/10000) + education) Resid. Df Resid. Dev Df Deviance Pr(>Chi) 1 748 993.73 2 743 978.96 5 14.774 0.01137 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > ## Table 21.3 > summary(gr_probit1) Call: glm(formula = participation ~ age + I(age^2) + I(fincome/10000) + education + kids, family = binomial(link = "probit"), data = PSID1976) Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -4.1568189 1.4040095 -2.961 0.003070 ** age 0.1853957 0.0662076 2.800 0.005107 ** I(age^2) -0.0024259 0.0007762 -3.125 0.001775 ** I(fincome/10000) 0.0458029 0.0430557 1.064 0.287417 education 0.0981824 0.0228932 4.289 1.8e-05 *** kidsyes -0.4489872 0.1300252 -3.453 0.000554 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 1029.7 on 752 degrees of freedom Residual deviance: 981.7 on 747 degrees of freedom AIC: 993.7 Number of Fisher Scoring iterations: 4 > > ## Example 22.8, Table 22.7, p. 786 > library("sampleSelection") Loading required package: maxLik Loading required package: miscTools Please cite the 'maxLik' package as: Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1. If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site: https://r-forge.r-project.org/projects/maxlik/ > gr_2step <- selection(participation ~ age + I(age^2) + fincome + education + kids, + wage ~ experience + I(experience^2) + education + city, + data = PSID1976, method = "2step") > gr_ml <- selection(participation ~ age + I(age^2) + fincome + education + kids, + wage ~ experience + I(experience^2) + education + city, + data = PSID1976, method = "ml") > gr_ols <- lm(wage ~ experience + I(experience^2) + education + city, + data = PSID1976, subset = participation == "yes") > ## NOTE: ML estimates agree with Greene, 5e errata. > ## Standard errors are based on the Hessian (here), while Greene has BHHH/OPG. > > > ####################### > ## Wooldridge (2002) ## > ####################### > > ## Table 15.1, p. 468 > wl_lpm <- lm(partnum ~ nwincome + education + experience + I(experience^2) + + age + youngkids + oldkids, data = PSID1976) > wl_logit <- glm(participation ~ nwincome + education + experience + I(experience^2) + + age + youngkids + oldkids, family = binomial, data = PSID1976) > wl_probit <- glm(participation ~ nwincome + education + experience + I(experience^2) + + age + youngkids + oldkids, family = binomial(link = "probit"), data = PSID1976) > ## (same as Altman et al.) > > ## convenience functions > pseudoR2 <- function(obj) 1 - as.vector(logLik(obj)/logLik(update(obj, . ~ 1))) > misclass <- function(obj) 1 - sum(diag(prop.table(table( + model.response(model.frame(obj)), round(fitted(obj)))))) > > coeftest(wl_logit) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 0.4254524 0.8603645 0.4945 0.620951 nwincome -0.0213452 0.0084214 -2.5346 0.011256 * education 0.2211704 0.0434393 5.0915 3.553e-07 *** experience 0.2058695 0.0320567 6.4220 1.345e-10 *** I(experience^2) -0.0031541 0.0010161 -3.1041 0.001909 ** age -0.0880244 0.0145729 -6.0403 1.538e-09 *** youngkids -1.4433541 0.2035828 -7.0898 1.343e-12 *** oldkids 0.0601122 0.0747893 0.8038 0.421539 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > logLik(wl_logit) 'log Lik.' -401.7652 (df=8) > misclass(wl_logit) [1] 0.2642762 > pseudoR2(wl_logit) [1] 0.2196814 > > coeftest(wl_probit) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 0.27007357 0.50807817 0.5316 0.595031 nwincome -0.01202364 0.00493917 -2.4343 0.014919 * education 0.13090397 0.02539873 5.1540 2.550e-07 *** experience 0.12334717 0.01875869 6.5755 4.850e-11 *** I(experience^2) -0.00188707 0.00059993 -3.1455 0.001658 ** age -0.05285244 0.00846236 -6.2456 4.222e-10 *** youngkids -0.86832468 0.11837727 -7.3352 2.213e-13 *** oldkids 0.03600561 0.04403026 0.8177 0.413502 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > logLik(wl_probit) 'log Lik.' -401.3022 (df=8) > misclass(wl_probit) [1] 0.2656042 > pseudoR2(wl_probit) [1] 0.2205805 > > ## Table 16.2, p. 528 > form <- hours ~ nwincome + education + experience + I(experience^2) + age + youngkids + oldkids > wl_ols <- lm(form, data = PSID1976) > wl_tobit <- tobit(form, data = PSID1976) > summary(wl_ols) Call: lm(formula = form, data = PSID1976) Residuals: Min 1Q Median 3Q Max -1511.3 -537.8 -146.9 538.1 3555.6 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1330.4824 270.7846 4.913 1.10e-06 *** nwincome -3.4466 2.5440 -1.355 0.1759 education 28.7611 12.9546 2.220 0.0267 * experience 65.6725 9.9630 6.592 8.23e-11 *** I(experience^2) -0.7005 0.3246 -2.158 0.0312 * age -30.5116 4.3639 -6.992 6.04e-12 *** youngkids -442.0899 58.8466 -7.513 1.66e-13 *** oldkids -32.7792 23.1762 -1.414 0.1577 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 750.2 on 745 degrees of freedom Multiple R-squared: 0.2656, Adjusted R-squared: 0.2587 F-statistic: 38.5 on 7 and 745 DF, p-value: < 2.2e-16 > summary(wl_tobit) Call: tobit(formula = hours ~ nwincome + education + experience + I(experience^2) + age + youngkids + oldkids, data = PSID1976) Observations: Total Left-censored Uncensored Right-censored 753 325 428 0 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 965.30528 446.43614 2.162 0.030599 * nwincome -8.81424 4.45910 -1.977 0.048077 * education 80.64561 21.58324 3.736 0.000187 *** experience 131.56430 17.27939 7.614 2.66e-14 *** I(experience^2) -1.86416 0.53766 -3.467 0.000526 *** age -54.40501 7.41850 -7.334 2.24e-13 *** youngkids -894.02174 111.87804 -7.991 1.34e-15 *** oldkids -16.21800 38.64139 -0.420 0.674701 Log(scale) 7.02289 0.03706 189.514 < 2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Scale: 1122 Gaussian distribution Number of Newton-Raphson Iterations: 4 Log-likelihood: -3819 on 9 Df Wald-statistic: 253.9 on 7 Df, p-value: < 2.22e-16 > > > ####################### > ## McCullough (2004) ## > ####################### > > ## p. 203 > mc_probit <- glm(participation ~ nwincome + education + experience + I(experience^2) + + age + youngkids + oldkids, family = binomial(link = "probit"), data = PSID1976) > mc_tobit <- tobit(hours ~ nwincome + education + experience + I(experience^2) + age + + youngkids + oldkids, data = PSID1976) > coeftest(mc_probit) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 0.27007357 0.50807817 0.5316 0.595031 nwincome -0.01202364 0.00493917 -2.4343 0.014919 * education 0.13090397 0.02539873 5.1540 2.550e-07 *** experience 0.12334717 0.01875869 6.5755 4.850e-11 *** I(experience^2) -0.00188707 0.00059993 -3.1455 0.001658 ** age -0.05285244 0.00846236 -6.2456 4.222e-10 *** youngkids -0.86832468 0.11837727 -7.3352 2.213e-13 *** oldkids 0.03600561 0.04403026 0.8177 0.413502 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > coeftest(mc_tobit) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 965.305283 446.436144 2.1622 0.0305991 * nwincome -8.814243 4.459100 -1.9767 0.0480771 * education 80.645606 21.583237 3.7365 0.0001866 *** experience 131.564299 17.279392 7.6139 2.659e-14 *** I(experience^2) -1.864158 0.537662 -3.4672 0.0005260 *** age -54.405011 7.418502 -7.3337 2.239e-13 *** youngkids -894.021739 111.878035 -7.9910 1.338e-15 *** oldkids -16.217996 38.641391 -0.4197 0.6747008 Log(scale) 7.022887 0.037057 189.5142 < 2.2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > coeftest(mc_tobit, vcov = vcovOPG) Error in model.matrix.default(terms(x), mf) : model frame and formula mismatch in model.matrix() Calls: coeftest ... estfun.survreg -> model.matrix -> model.matrix.default Execution halted Package: AER Check: tests New result: ERROR Running ‘Ch-Basics.R’ [2s/2s] Comparing ‘Ch-Basics.Rout’ to ‘Ch-Basics.Rout.save’ ... OK Running ‘Ch-Intro.R’ [3s/3s] Comparing ‘Ch-Intro.Rout’ to ‘Ch-Intro.Rout.save’ ... OK Running ‘Ch-LinearRegression.R’ [6s/6s] Comparing ‘Ch-LinearRegression.Rout’ to ‘Ch-LinearRegression.Rout.save’ ... OK Running ‘Ch-Microeconometrics.R’ [3s/3s] Running ‘Ch-Programming.R’ [26s/26s] Comparing ‘Ch-Programming.Rout’ to ‘Ch-Programming.Rout.save’ ... OK Running ‘Ch-TimeSeries.R’ [4s/4s] Comparing ‘Ch-TimeSeries.Rout’ to ‘Ch-TimeSeries.Rout.save’ ... OK Running ‘Ch-Validation.R’ [46s/46s] Comparing ‘Ch-Validation.Rout’ to ‘Ch-Validation.Rout.save’ ... OK Running the tests in ‘tests/Ch-Microeconometrics.R’ failed. Complete output: > if(!requireNamespace("ROCR") || + !requireNamespace("MASS") || + !requireNamespace("pscl") || + !requireNamespace("np") || + !requireNamespace("nnet")) q() Loading required namespace: ROCR Loading required namespace: MASS Loading required namespace: pscl Loading required namespace: np Loading required namespace: nnet > > ################################################### > ### chunk number 1: setup > ################################################### > options(prompt = "R> ", continue = "+ ", width = 64, + digits = 4, show.signif.stars = FALSE, useFancyQuotes = FALSE) R> R> options(SweaveHooks = list(onefig = function() {par(mfrow = c(1,1))}, + twofig = function() {par(mfrow = c(1,2))}, + threefig = function() {par(mfrow = c(1,3))}, + fourfig = function() {par(mfrow = c(2,2))}, + sixfig = function() {par(mfrow = c(3,2))})) R> R> library("AER") Loading required package: car Loading required package: carData Loading required package: lmtest Loading required package: zoo Attaching package: 'zoo' The following objects are masked from 'package:base': as.Date, as.Date.numeric Loading required package: sandwich Loading required package: survival R> R> suppressWarnings(RNGversion("3.5.0")) R> set.seed(1071) R> R> R> ################################################### R> ### chunk number 2: swisslabor-data R> ################################################### R> data("SwissLabor") R> swiss_probit <- glm(participation ~ . + I(age^2), + data = SwissLabor, family = binomial(link = "probit")) R> summary(swiss_probit) Call: glm(formula = participation ~ . + I(age^2), family = binomial(link = "probit"), data = SwissLabor) Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 3.7491 1.4069 2.66 0.0077 income -0.6669 0.1320 -5.05 4.3e-07 age 2.0753 0.4054 5.12 3.1e-07 education 0.0192 0.0179 1.07 0.2843 youngkids -0.7145 0.1004 -7.12 1.1e-12 oldkids -0.1470 0.0509 -2.89 0.0039 foreignyes 0.7144 0.1213 5.89 3.9e-09 I(age^2) -0.2943 0.0499 -5.89 3.8e-09 (Dispersion parameter for binomial family taken to be 1) Null deviance: 1203.2 on 871 degrees of freedom Residual deviance: 1017.2 on 864 degrees of freedom AIC: 1033 Number of Fisher Scoring iterations: 4 R> R> R> ################################################### R> ### chunk number 3: swisslabor-plot eval=FALSE R> ################################################### R> ## plot(participation ~ age, data = SwissLabor, ylevels = 2:1) R> R> R> ################################################### R> ### chunk number 4: swisslabor-plot-refined R> ################################################### R> plot(participation ~ education, data = SwissLabor, ylevels = 2:1) R> fm <- glm(participation ~ education + I(education^2), data = SwissLabor, family = binomial) R> edu <- sort(unique(SwissLabor$education)) R> prop <- sapply(edu, function(x) mean(SwissLabor$education <= x)) R> lines(predict(fm, newdata = data.frame(education = edu), type = "response") ~ prop, col = 2) R> R> plot(participation ~ age, data = SwissLabor, ylevels = 2:1) R> fm <- glm(participation ~ age + I(age^2), data = SwissLabor, family = binomial) R> ag <- sort(unique(SwissLabor$age)) R> prop <- sapply(ag, function(x) mean(SwissLabor$age <= x)) R> lines(predict(fm, newdata = data.frame(age = ag), type = "response") ~ prop, col = 2) R> R> R> ################################################### R> ### chunk number 5: effects1 R> ################################################### R> fav <- mean(dnorm(predict(swiss_probit, type = "link"))) R> fav * coef(swiss_probit) (Intercept) income age education youngkids 1.241930 -0.220932 0.687466 0.006359 -0.236682 oldkids foreignyes I(age^2) -0.048690 0.236644 -0.097505 R> R> R> ################################################### R> ### chunk number 6: effects2 R> ################################################### R> av <- colMeans(SwissLabor[, -c(1, 7)]) R> av <- data.frame(rbind(swiss = av, foreign = av), + foreign = factor(c("no", "yes"))) R> av <- predict(swiss_probit, newdata = av, type = "link") R> av <- dnorm(av) R> av["swiss"] * coef(swiss_probit)[-7] (Intercept) income age education youngkids 1.495137 -0.265976 0.827628 0.007655 -0.284938 oldkids I(age^2) -0.058617 -0.117384 R> R> R> ################################################### R> ### chunk number 7: effects3 R> ################################################### R> av["foreign"] * coef(swiss_probit)[-7] (Intercept) income age education youngkids 1.136517 -0.202180 0.629115 0.005819 -0.216593 oldkids I(age^2) -0.044557 -0.089229 R> R> R> ################################################### R> ### chunk number 8: mcfadden R> ################################################### R> swiss_probit0 <- update(swiss_probit, formula = . ~ 1) R> 1 - as.vector(logLik(swiss_probit)/logLik(swiss_probit0)) [1] 0.1546 R> R> R> ################################################### R> ### chunk number 9: confusion-matrix R> ################################################### R> table(true = SwissLabor$participation, + pred = round(fitted(swiss_probit))) pred true 0 1 no 337 134 yes 146 255 R> R> R> ################################################### R> ### chunk number 10: confusion-matrix1 R> ################################################### R> tab <- table(true = SwissLabor$participation, + pred = round(fitted(swiss_probit))) R> tabp <- round(100 * c(tab[1,1] + tab[2,2], tab[2,1] + tab[1,2])/sum(tab), digits = 2) R> R> R> ################################################### R> ### chunk number 11: roc-plot eval=FALSE R> ################################################### R> ## library("ROCR") R> ## pred <- prediction(fitted(swiss_probit), R> ## SwissLabor$participation) R> ## plot(performance(pred, "acc")) R> ## plot(performance(pred, "tpr", "fpr")) R> ## abline(0, 1, lty = 2) R> R> R> ################################################### R> ### chunk number 12: roc-plot1 R> ################################################### R> library("ROCR") R> pred <- prediction(fitted(swiss_probit), + SwissLabor$participation) R> plot(performance(pred, "acc")) R> plot(performance(pred, "tpr", "fpr")) R> abline(0, 1, lty = 2) R> R> R> ################################################### R> ### chunk number 13: rss R> ################################################### R> deviance(swiss_probit) [1] 1017 R> sum(residuals(swiss_probit, type = "deviance")^2) [1] 1017 R> sum(residuals(swiss_probit, type = "pearson")^2) [1] 866.5 R> R> R> ################################################### R> ### chunk number 14: coeftest eval=FALSE R> ################################################### R> ## coeftest(swiss_probit, vcov = sandwich) R> R> R> ################################################### R> ### chunk number 15: murder R> ################################################### R> data("MurderRates") R> ## murder_logit <- glm(I(executions > 0) ~ time + income + ## IGNORE_RDIFF, excluded due to small numeric deviations on different platforms R> ## noncauc + lfp + southern, data = MurderRates, R> ## family = binomial) R> ## R> ## R> ## ################################################### R> ## ### chunk number 16: murder-coeftest R> ## ################################################### R> ## coeftest(murder_logit) R> ## R> ## R> ## ################################################### R> ## ### chunk number 17: murder2 R> ## ################################################### R> ## murder_logit2 <- glm(I(executions > 0) ~ time + income + R> ## noncauc + lfp + southern, data = MurderRates, R> ## family = binomial, control = list(epsilon = 1e-15, R> ## maxit = 50, trace = FALSE)) R> ## R> ## R> ## ################################################### R> ## ### chunk number 18: murder2-coeftest R> ## ################################################### R> ## coeftest(murder_logit2) R> R> R> ################################################### R> ### chunk number 19: separation R> ################################################### R> table(I(MurderRates$executions > 0), MurderRates$southern) no yes FALSE 9 0 TRUE 20 15 R> R> R> ################################################### R> ### chunk number 20: countreg-pois R> ################################################### R> data("RecreationDemand") R> rd_pois <- glm(trips ~ ., data = RecreationDemand, + family = poisson) R> R> R> ################################################### R> ### chunk number 21: countreg-pois-coeftest R> ################################################### R> coeftest(rd_pois) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 0.26499 0.09372 2.83 0.0047 quality 0.47173 0.01709 27.60 < 2e-16 skiyes 0.41821 0.05719 7.31 2.6e-13 income -0.11132 0.01959 -5.68 1.3e-08 userfeeyes 0.89817 0.07899 11.37 < 2e-16 costC -0.00343 0.00312 -1.10 0.2713 costS -0.04254 0.00167 -25.47 < 2e-16 costH 0.03613 0.00271 13.34 < 2e-16 R> R> R> ################################################### R> ### chunk number 22: countreg-pois-logLik R> ################################################### R> logLik(rd_pois) 'log Lik.' -1529 (df=8) R> R> R> ################################################### R> ### chunk number 23: countreg-odtest1 R> ################################################### R> dispersiontest(rd_pois) Overdispersion test data: rd_pois z = 2.4, p-value = 0.008 alternative hypothesis: true dispersion is greater than 1 sample estimates: dispersion 6.566 R> R> R> ################################################### R> ### chunk number 24: countreg-odtest2 R> ################################################### R> dispersiontest(rd_pois, trafo = 2) Overdispersion test data: rd_pois z = 2.9, p-value = 0.002 alternative hypothesis: true alpha is greater than 0 sample estimates: alpha 1.316 R> R> R> ################################################### R> ### chunk number 25: countreg-nbin R> ################################################### R> library("MASS") R> rd_nb <- glm.nb(trips ~ ., data = RecreationDemand) R> coeftest(rd_nb) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -1.12194 0.21430 -5.24 1.6e-07 quality 0.72200 0.04012 18.00 < 2e-16 skiyes 0.61214 0.15030 4.07 4.6e-05 income -0.02606 0.04245 -0.61 0.539 userfeeyes 0.66917 0.35302 1.90 0.058 costC 0.04801 0.00918 5.23 1.7e-07 costS -0.09269 0.00665 -13.93 < 2e-16 costH 0.03884 0.00775 5.01 5.4e-07 R> logLik(rd_nb) 'log Lik.' -825.6 (df=9) R> R> R> ################################################### R> ### chunk number 26: countreg-se R> ################################################### R> round(sqrt(rbind(diag(vcov(rd_pois)), + diag(sandwich(rd_pois)))), digits = 3) (Intercept) quality skiyes income userfeeyes costC costS [1,] 0.094 0.017 0.057 0.02 0.079 0.003 0.002 [2,] 0.432 0.049 0.194 0.05 0.247 0.015 0.012 costH [1,] 0.003 [2,] 0.009 R> R> R> ################################################### R> ### chunk number 27: countreg-sandwich R> ################################################### R> coeftest(rd_pois, vcov = sandwich) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 0.26499 0.43248 0.61 0.54006 quality 0.47173 0.04885 9.66 < 2e-16 skiyes 0.41821 0.19387 2.16 0.03099 income -0.11132 0.05031 -2.21 0.02691 userfeeyes 0.89817 0.24691 3.64 0.00028 costC -0.00343 0.01470 -0.23 0.81549 costS -0.04254 0.01173 -3.62 0.00029 costH 0.03613 0.00939 3.85 0.00012 R> R> R> ################################################### R> ### chunk number 28: countreg-OPG R> ################################################### R> round(sqrt(diag(vcovOPG(rd_pois))), 3) (Intercept) quality skiyes income userfeeyes 0.025 0.007 0.020 0.010 0.033 costC costS costH 0.001 0.000 0.001 R> R> R> ################################################### R> ### chunk number 29: countreg-plot R> ################################################### R> plot(table(RecreationDemand$trips), ylab = "") R> R> R> ################################################### R> ### chunk number 30: countreg-zeros R> ################################################### R> rbind(obs = table(RecreationDemand$trips)[1:10], exp = round( + sapply(0:9, function(x) sum(dpois(x, fitted(rd_pois)))))) 0 1 2 3 4 5 6 7 8 9 obs 417 68 38 34 17 13 11 2 8 1 exp 277 146 68 41 30 23 17 13 10 7 R> R> R> ################################################### R> ### chunk number 31: countreg-pscl R> ################################################### R> library("pscl") Classes and Methods for R originally developed in the Political Science Computational Laboratory Department of Political Science Stanford University (2002-2015), by and under the direction of Simon Jackman. hurdle and zeroinfl functions by Achim Zeileis. R> R> R> ################################################### R> ### chunk number 32: countreg-zinb R> ################################################### R> rd_zinb <- zeroinfl(trips ~ . | quality + income, + data = RecreationDemand, dist = "negbin") R> R> R> ################################################### R> ### chunk number 33: countreg-zinb-summary R> ################################################### R> summary(rd_zinb) Call: zeroinfl(formula = trips ~ . | quality + income, data = RecreationDemand, dist = "negbin") Pearson residuals: Min 1Q Median 3Q Max -1.0889 -0.2004 -0.0570 -0.0451 40.0139 Count model coefficients (negbin with log link): Estimate Std. Error z value Pr(>|z|) (Intercept) 1.09663 0.25668 4.27 1.9e-05 quality 0.16891 0.05303 3.19 0.0014 skiyes 0.50069 0.13449 3.72 0.0002 income -0.06927 0.04380 -1.58 0.1138 userfeeyes 0.54279 0.28280 1.92 0.0549 costC 0.04044 0.01452 2.79 0.0053 costS -0.06621 0.00775 -8.55 < 2e-16 costH 0.02060 0.01023 2.01 0.0441 Log(theta) 0.19017 0.11299 1.68 0.0924 Zero-inflation model coefficients (binomial with logit link): Estimate Std. Error z value Pr(>|z|) (Intercept) 5.743 1.556 3.69 0.00022 quality -8.307 3.682 -2.26 0.02404 income -0.258 0.282 -0.92 0.35950 Theta = 1.209 Number of iterations in BFGS optimization: 26 Log-likelihood: -722 on 12 Df R> R> R> ################################################### R> ### chunk number 34: countreg-zinb-expected R> ################################################### R> round(colSums(predict(rd_zinb, type = "prob")[,1:10])) 0 1 2 3 4 5 6 7 8 9 433 47 35 27 20 16 12 10 8 7 R> R> R> ################################################### R> ### chunk number 35: countreg-hurdle R> ################################################### R> rd_hurdle <- hurdle(trips ~ . | quality + income, + data = RecreationDemand, dist = "negbin") R> summary(rd_hurdle) Call: hurdle(formula = trips ~ . | quality + income, data = RecreationDemand, dist = "negbin") Pearson residuals: Min 1Q Median 3Q Max -1.610 -0.207 -0.185 -0.164 12.111 Count model coefficients (truncated negbin with log link): Estimate Std. Error z value Pr(>|z|) (Intercept) 0.8419 0.3828 2.20 0.0278 quality 0.1717 0.0723 2.37 0.0176 skiyes 0.6224 0.1901 3.27 0.0011 income -0.0571 0.0645 -0.88 0.3763 userfeeyes 0.5763 0.3851 1.50 0.1345 costC 0.0571 0.0217 2.63 0.0085 costS -0.0775 0.0115 -6.71 1.9e-11 costH 0.0124 0.0149 0.83 0.4064 Log(theta) -0.5303 0.2611 -2.03 0.0423 Zero hurdle model coefficients (binomial with logit link): Estimate Std. Error z value Pr(>|z|) (Intercept) -2.7663 0.3623 -7.64 2.3e-14 quality 1.5029 0.1003 14.98 < 2e-16 income -0.0447 0.0785 -0.57 0.57 Theta: count = 0.588 Number of iterations in BFGS optimization: 18 Log-likelihood: -765 on 12 Df R> R> R> ################################################### R> ### chunk number 36: countreg-hurdle-expected R> ################################################### R> round(colSums(predict(rd_hurdle, type = "prob")[,1:10])) 0 1 2 3 4 5 6 7 8 9 417 74 42 27 19 14 10 8 6 5 R> R> R> ################################################### R> ### chunk number 37: tobit1 R> ################################################### R> data("Affairs") R> aff_tob <- tobit(affairs ~ age + yearsmarried + + religiousness + occupation + rating, data = Affairs) R> summary(aff_tob) Call: tobit(formula = affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs) Observations: Total Left-censored Uncensored Right-censored 601 451 150 0 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 8.1742 2.7414 2.98 0.0029 age -0.1793 0.0791 -2.27 0.0234 yearsmarried 0.5541 0.1345 4.12 3.8e-05 religiousness -1.6862 0.4038 -4.18 3.0e-05 occupation 0.3261 0.2544 1.28 0.2000 rating -2.2850 0.4078 -5.60 2.1e-08 Log(scale) 2.1099 0.0671 31.44 < 2e-16 Scale: 8.25 Gaussian distribution Number of Newton-Raphson Iterations: 4 Log-likelihood: -706 on 7 Df Wald-statistic: 67.7 on 5 Df, p-value: 3.1e-13 R> R> R> ################################################### R> ### chunk number 38: tobit2 R> ################################################### R> aff_tob2 <- update(aff_tob, right = 4) R> summary(aff_tob2) Call: tobit(formula = affairs ~ age + yearsmarried + religiousness + occupation + rating, right = 4, data = Affairs) Observations: Total Left-censored Uncensored Right-censored 601 451 70 80 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 7.9010 2.8039 2.82 0.00483 age -0.1776 0.0799 -2.22 0.02624 yearsmarried 0.5323 0.1412 3.77 0.00016 religiousness -1.6163 0.4244 -3.81 0.00014 occupation 0.3242 0.2539 1.28 0.20162 rating -2.2070 0.4498 -4.91 9.3e-07 Log(scale) 2.0723 0.1104 18.77 < 2e-16 Scale: 7.94 Gaussian distribution Number of Newton-Raphson Iterations: 4 Log-likelihood: -500 on 7 Df Wald-statistic: 42.6 on 5 Df, p-value: 4.5e-08 R> R> R> ################################################### R> ### chunk number 39: tobit3 R> ################################################### R> linearHypothesis(aff_tob, c("age = 0", "occupation = 0"), + vcov = sandwich) Error in model.matrix.default(terms(x), mf) : model frame and formula mismatch in model.matrix() Calls: linearHypothesis ... estfun.survreg -> model.matrix -> model.matrix.default Execution halted Package: CauchyCP Check: examples New result: ERROR Running examples in ‘CauchyCP-Ex.R’ failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: CauchyCP > ### Title: A robust test under non-proportional hazards using Cauchy > ### combination of change-point Cox regressions. > ### Aliases: CauchyCP > > ### ** Examples > > data(gast) > CauchyCP(time=gast$time, status=gast$status, x=gast$trt) Error in anova.coxphlist(object, test = test) : models do not have the same strata Calls: CauchyCP -> anova -> anova.coxph -> anova.coxphlist Execution halted Package: MASS Check: differences from ‘MASS-Ex.Rout’ to ‘MASS-Ex.Rout.save’ New result: NOTE 2691c2691 < Number of Newton-Raphson Iterations: 8 --- > Number of Newton-Raphson Iterations: 7 Package: RESI Check: tests New result: ERROR Running ‘testthat.R’ [111s/111s] Running the tests in ‘tests/testthat.R’ failed. Complete output: > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/tests.html > # * https://testthat.r-lib.org/reference/test_package.html#special-files > > library(testthat) > library(RESI) > > test_check("RESI") Loading required package: carData Loading required namespace: splines Loading required namespace: survival Loading required namespace: pscl Loading required namespace: gee Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27 running glm to get initial regression estimate (Intercept) diagnosesevere drugstandard time -0.08759224 -1.31391092 0.05960381 1.49985707 drugstandard:time -1.01744498 Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27 running glm to get initial regression estimate (Intercept) 0.0902573 Loading required namespace: geepack Loading required namespace: lme4 boundary (singular) fit: see help('isSingular') Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27 running glm to get initial regression estimate (Intercept) diagnosesevere drugstandard time -0.08759224 -1.31391092 0.05960381 1.49985707 drugstandard:time -1.01744498 Updating model fit failed. Try running with providing data argument Updating model fit failed. Try running with providing data argument [ FAIL 7 | WARN 0 | SKIP 0 | PASS 50 ] ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-resi.R:142:3'): Specifying non-allowed vcov produces warning ─── Error in `value[[3L]](cond)`: car::Anova failed. Try rerunning with anova = FALSE Backtrace: ▆ 1. ├─testthat::expect_warning(...) at test-resi.R:142:3 2. │ └─testthat:::expect_condition_matching(...) 3. │ └─testthat:::quasi_capture(...) 4. │ ├─testthat (local) .capture(...) 5. │ │ └─base::withCallingHandlers(...) 6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) 7. ├─RESI::resi(mod.surv, data = data.surv, nboot = 1, vcovfunc = sandwich::vcovHC) 8. └─RESI:::resi.survreg(mod.surv, data = data.surv, nboot = 1, vcovfunc = sandwich::vcovHC) 9. └─RESI:::resi.default(...) 10. ├─RESI::resi_pe(...) 11. └─RESI:::resi_pe.survreg(...) 12. └─RESI:::resi_pe.default(...) 13. └─base::tryCatch(...) 14. └─base (local) tryCatchList(expr, classes, parentenv, handlers) 15. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. └─value[[3L]](cond) ── Error ('test-resi.R:192:3'): resi produces the correct estimates ──────────── Error in `value[[3L]](cond)`: car::Anova failed. Try rerunning with anova = FALSE Backtrace: ▆ 1. ├─testthat::expect_equal(...) at test-resi.R:192:3 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object") 3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) 4. ├─base::unname(resi(mod.surv, nboot = 1, data = data.surv)$estimates) 5. ├─RESI::resi(mod.surv, nboot = 1, data = data.surv) 6. └─RESI:::resi.survreg(mod.surv, nboot = 1, data = data.surv) 7. └─RESI:::resi.default(...) 8. ├─RESI::resi_pe(...) 9. └─RESI:::resi_pe.survreg(...) 10. └─RESI:::resi_pe.default(...) 11. └─base::tryCatch(...) 12. └─base (local) tryCatchList(expr, classes, parentenv, handlers) 13. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 14. └─value[[3L]](cond) ── Error ('test-resi.R:280:3'): unbiased = FALSE returns same abs. RESI as Chi-sq/F ── Error in `value[[3L]](cond)`: car::Anova failed. Try rerunning with anova = FALSE Backtrace: ▆ 1. ├─RESI::resi(mod.surv, data = data.surv, nboot = 1, unbiased = FALSE) at test-resi.R:280:3 2. └─RESI:::resi.survreg(mod.surv, data = data.surv, nboot = 1, unbiased = FALSE) 3. └─RESI:::resi.default(...) 4. ├─RESI::resi_pe(...) 5. └─RESI:::resi_pe.survreg(...) 6. └─RESI:::resi_pe.default(...) 7. └─base::tryCatch(...) 8. └─base (local) tryCatchList(expr, classes, parentenv, handlers) 9. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 10. └─value[[3L]](cond) ── Error ('test-resi.R:304:3'): Specifying a reduced model only changes overall output ── Error in `value[[3L]](cond)`: car::Anova failed. Try rerunning with anova = FALSE Backtrace: ▆ 1. ├─RESI::resi(mod.surv, data = data.surv, nboot = 1) at test-resi.R:304:3 2. └─RESI:::resi.survreg(mod.surv, data = data.surv, nboot = 1) 3. └─RESI:::resi.default(...) 4. ├─RESI::resi_pe(...) 5. └─RESI:::resi_pe.survreg(...) 6. └─RESI:::resi_pe.default(...) 7. └─base::tryCatch(...) 8. └─base (local) tryCatchList(expr, classes, parentenv, handlers) 9. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 10. └─value[[3L]](cond) ── Error ('test-resi.R:322:3'): specifying additional Anova args works ───────── Error in `value[[3L]](cond)`: car::Anova failed. Try rerunning with anova = FALSE Backtrace: ▆ 1. ├─testthat::expect_false(...) at test-resi.R:322:3 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object") 3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) 4. ├─RESI::resi(mod.surv, data = data.surv, nboot = 1, Anova.args = list(type = "3")) 5. └─RESI:::resi.survreg(mod.surv, data = data.surv, nboot = 1, Anova.args = list(type = "3")) 6. └─RESI:::resi.default(...) 7. ├─RESI::resi_pe(...) 8. └─RESI:::resi_pe.survreg(...) 9. └─RESI:::resi_pe.default(...) 10. └─base::tryCatch(...) 11. └─base (local) tryCatchList(expr, classes, parentenv, handlers) 12. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 13. └─value[[3L]](cond) ── Error ('test-resi.R:343:3'): tibbles work ─────────────────────────────────── Error in `value[[3L]](cond)`: car::Anova failed. Try rerunning with anova = FALSE Backtrace: ▆ 1. ├─testthat::expect_equal(...) at test-resi.R:343:3 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object") 3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) 4. ├─base::unname(resi(mod.surv.tib, nboot = 1, data = data.surv)$estimates) 5. ├─RESI::resi(mod.surv.tib, nboot = 1, data = data.surv) 6. └─RESI:::resi.survreg(mod.surv.tib, nboot = 1, data = data.surv) 7. └─RESI:::resi.default(...) 8. ├─RESI::resi_pe(...) 9. └─RESI:::resi_pe.survreg(...) 10. └─RESI:::resi_pe.default(...) 11. └─base::tryCatch(...) 12. └─base (local) tryCatchList(expr, classes, parentenv, handlers) 13. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 14. └─value[[3L]](cond) ── Error ('test-resi.R:366:5'): intercept-only full model works and doesn't have overall element ── Error in `value[[3L]](cond)`: car::Anova failed. Try rerunning with anova = FALSE Backtrace: ▆ 1. ├─testthat::expect_true(...) at test-resi.R:366:5 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object") 3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) 4. ├─RESI::resi(mod.surv.int, data = data.surv, nboot = 1, Anova.args = list(type = 3)) 5. └─RESI:::resi.survreg(...) 6. └─RESI:::resi.default(...) 7. ├─RESI::resi_pe(...) 8. └─RESI:::resi_pe.survreg(...) 9. └─RESI:::resi_pe.default(...) 10. └─base::tryCatch(...) 11. └─base (local) tryCatchList(expr, classes, parentenv, handlers) 12. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 13. └─value[[3L]](cond) [ FAIL 7 | WARN 0 | SKIP 0 | PASS 50 ] Error: Test failures Execution halted Package: rineq Check: examples New result: ERROR Running examples in ‘rineq-Ex.R’ failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: contribution > ### Title: Function to decompose the Relative Concentration Index into its > ### components > ### Aliases: contribution > > ### ** Examples > > data(housing) > > ## Linear regression direct decomposition > fit.lm <- lm(bmi ~ sex + tenure + place + age,data = housing) > > # decompose relative concentration index > contrib.lm <- contribution(fit.lm, housing$income) > summary(contrib.lm) Overall CI: 0.121004 95% confidence interval: 0.1181791 0.123829 Decomposition: Contribution (%) Contribution (Abs) Elasticity residual 38.2448886 0.0462779 0.0000000 sexmale 70.3033532 0.0850699 0.2241433 tenureirregular -16.8438839 -0.0203818 0.0307882 tenureown_apartment 0.0751962 0.0000910 0.0018771 tenureown_house 1.3489119 0.0016322 0.0136284 tenurerent 6.6988511 0.0081059 0.0517000 placeurban 0.0671404 0.0000812 -0.0123887 age 0.1055426 0.0001277 0.0324067 Concentration Index lower 5% upper 5% Corrected residual NA NA NA no sexmale 0.3795336 0.3691540 0.3899131 no tenureirregular -0.6619993 -0.6980505 -0.6259481 no tenureown_apartment 0.0484737 0.0260028 0.0709447 no tenureown_house 0.1197676 0.0926766 0.1468586 no tenurerent 0.1567869 0.1440879 0.1694859 no placeurban -0.0065578 -0.0188208 0.0057052 no age 0.0039409 -0.0000583 0.0079401 no > plot(contrib.lm, decreasing = FALSE, horiz = TRUE) > > > # GLM: Decomposition based on predicted outcome > fit.logit <-glm(high.bmi ~ sex + tenure + place + age, data = housing) > > contrib.logit <- contribution(fit.logit, housing$income) > summary(contrib.logit) Overall CI: 0.2502025 95% confidence interval: 0.2429066 0.2574983 Decomposition: Contribution (%) Contribution (Abs) Elasticity residual 0.0000000 0.0000000 0.0000000 sexmale 108.4563232 0.2713604 0.7149839 tenureirregular -17.2872968 -0.0432532 0.0653373 tenureown_apartment 0.1140275 0.0002853 0.0058857 tenureown_house 1.4916426 0.0037321 0.0311614 tenurerent 7.0608518 0.0176664 0.1126780 placeurban 0.0573415 0.0001435 -0.0218778 age 0.1071102 0.0002680 0.0680031 Concentration Index lower 5% upper 5% Corrected residual NA NA NA no sexmale 0.3795336 0.3691540 0.3899131 no tenureirregular -0.6619993 -0.6980505 -0.6259481 no tenureown_apartment 0.0484737 0.0260028 0.0709447 no tenureown_house 0.1197676 0.0926766 0.1468586 no tenurerent 0.1567869 0.1440879 0.1694859 no placeurban -0.0065578 -0.0188208 0.0057052 no age 0.0039409 -0.0000583 0.0079401 no > plot(contrib.logit, decreasing = FALSE,horiz = TRUE) > > > # GLM probit: Decomposition based on predicted outcome > fit.probit <-glm(high.bmi ~ sex + tenure + place + age, data = housing, + family = binomial(link = probit)) > > # binary, set type to 'CIw' > contrib.probit <- contribution(fit.probit, housing$income, type = "CIw") > summary(contrib.probit) Overall CI: -0.26355 95% confidence interval: -0.2718336 -0.2552664 (based on a corrected value) Decomposition: Contribution (%) Contribution (Abs) Elasticity residual 272.0517695 -0.7169924 0.0000000 sexmale -179.3760257 0.4727455 0.6287769 tenureirregular 25.5830437 -0.0674241 0.0866431 tenureown_apartment -0.1800413 0.0004745 0.0077997 tenureown_house -2.1688445 0.0057160 0.0404237 tenurerent -15.7773222 0.0415811 0.1471374 placeurban -0.1352142 0.0003564 -0.0293442 age 0.0026347 -0.0000069 0.0893297 Concentration Index lower 5% upper 5% Corrected residual NA NA NA no sexmale 0.7518494 0.7312877 0.7724110 no tenureirregular -0.7781818 -0.8205601 -0.7358035 no tenureown_apartment 0.0608355 0.0326340 0.0890370 no tenureown_house 0.1414021 0.1094175 0.1733867 no tenurerent 0.2826007 0.2597114 0.3054901 no placeurban -0.0121440 -0.0348533 0.0105652 no age -0.0000777 -0.0001566 0.0000012 no > plot(contrib.probit, decreasing = FALSE,horiz = TRUE) > > > # Marginal effects probit using package 'mfx': Decomposition based on predicted outcome > fit.mfx <-mfx::probitmfx(high.bmi ~ sex + tenure + place + age, data = housing) > > contrib.mfx <- contribution(fit.mfx, housing$income, type = "CIw") > summary(contrib.mfx, type="CIw") Overall CI: 0.6906082 95% confidence interval: 0.6694697 0.7117467 Decomposition: Contribution (%) Contribution (Abs) Elasticity residual 22.2833787 0.1538908 0.0000000 sexmale 80.4392036 0.5555197 0.7388710 tenureirregular -12.5529543 -0.0866917 0.1114029 tenureown_apartment 0.0984600 0.0006800 0.0111772 tenureown_house 1.1582469 0.0079989 0.0565688 tenurerent 8.5011533 0.0587097 0.2077477 placeurban 0.0739535 0.0005107 -0.0420559 age -0.0014417 -0.0000100 0.1280922 Concentration Index lower 5% upper 5% Corrected residual NA NA NA no sexmale 0.7518494 0.7312877 0.7724110 no tenureirregular -0.7781818 -0.8205601 -0.7358035 no tenureown_apartment 0.0608355 0.0326340 0.0890370 no tenureown_house 0.1414021 0.1094175 0.1733867 no tenurerent 0.2826007 0.2597114 0.3054901 no placeurban -0.0121440 -0.0348533 0.0105652 no age -0.0000777 -0.0001566 0.0000012 no > plot(contrib.mfx, decreasing = FALSE, horiz = TRUE) > > > # package survey svy > des = survey::svydesign(~1, data= housing, weights = rep(1, NROW(housing))) > fit.svy = survey::svyglm(bmi ~ tenure+height+weight, design = des) > contrib.svy = contribution(fit.svy, housing$income) > > > # adopted from the `coxph` example in survival package > testcph <- data.frame(time = c(4,3,1,1,2,2,3), + status = c(1,1,1,0,1,1,0), + x = c(0,2,1,1,1,0,0), + sex = c(0,0,0,0,1,1,1), + income = c(100,50, 20, 20, 50, 60,100)) > > # Fit a stratified model > fit.coxph = survival::coxph(survival::Surv(time, status) ~ x + survival::strata(sex), testcph) > contrib.coxph = contribution(fit.coxph, testcph$income) Error in model.matrix(object)[, names(object$coefficients)][, -1, drop = F] : incorrect number of dimensions Calls: contribution -> contribution.coxph Execution halted Package: sandwich Check: re-building of vignette outputs New result: ERROR Error(s) in re-building vignettes: ... --- re-building ‘sandwich-CL.Rnw’ using Sweave Loading required package: geepack Loading required package: lattice Loading required package: lme4 Loading required package: Matrix Loading required package: lmtest Loading required package: zoo Attaching package: ‘zoo’ The following objects are masked from ‘package:base’: as.Date, as.Date.numeric Loading required package: multiwayvcov Loading required package: pcse Attaching package: ‘pcse’ The following object is masked from ‘package:sandwich’: vcovPC Loading required package: plm Loading required package: pscl Classes and Methods for R originally developed in the Political Science Computational Laboratory Department of Political Science Stanford University (2002-2015), by and under the direction of Simon Jackman. hurdle and zeroinfl functions by Achim Zeileis. --- finished re-building ‘sandwich-CL.Rnw’ --- re-building ‘sandwich-OOP.Rnw’ using Sweave Loading required package: AER Loading required package: car Loading required package: carData Loading required package: lmtest Loading required package: zoo Attaching package: ‘zoo’ The following objects are masked from ‘package:base’: as.Date, as.Date.numeric Loading required package: sandwich Loading required package: survival Loading required package: MASS Error: processing vignette 'sandwich-OOP.Rnw' failed with diagnostics: chunk 10 Error in model.matrix.default(terms(x), mf) : model frame and formula mismatch in model.matrix() --- failed re-building ‘sandwich-OOP.Rnw’ --- re-building ‘sandwich.Rnw’ using Sweave Attaching package: ‘zoo’ The following objects are masked from ‘package:base’: as.Date, as.Date.numeric Loading required package: strucchange Loading required package: lmtest Loading required package: scatterplot3d --- finished re-building ‘sandwich.Rnw’ SUMMARY: processing the following file failed: ‘sandwich-OOP.Rnw’ Error: Vignette re-building failed. Execution halted Package: sandwich Check: running R code from vignettes New result: ERROR Errors in running code in vignettes: when running code in ‘sandwich-OOP.Rnw’ ... > options(prompt = "R> ", continue = "+ ") > if (!require("AER")) tobit <- glm Loading required package: AER Loading required package: car Loading required package: carData Loading required package: lmtest Loading required package: zoo Attaching package: ‘zoo’ The following objects are masked from ‘package:base’: as.Date, as.Date.numeric Loading required package: sandwich Loading required package: survival > if (!require("MASS")) glm.nb <- glm Loading required package: MASS > if (!require("lmtest")) coeftest <- function(object, + ...) summary(object)$coefficients > warn <- if (require("AER") & require("MASS") & require("lmtest")) "" else "{\\\\large\\\\bf\\\\color{Red}\n Not all required packages were availab ..." ... [TRUNCATED] > par(mar = rep(0, 4)) > plot(0, 0, xlim = c(0, 85), ylim = c(0, 110), type = "n", + axes = FALSE, xlab = "", ylab = "") > lgrey <- grey(0.88) > dgrey <- grey(0.75) > rect(45, 90, 70, 110, lwd = 2, col = dgrey) > rect(20, 40, 40, 60, col = lgrey) > rect(30, 40, 40, 60, col = dgrey) > rect(20, 40, 40, 60, lwd = 2) > rect(5, 0, 20, 20, lwd = 2, col = lgrey) > rect(22.5, 0, 37.5, 20, lwd = 2, col = lgrey) > rect(40, 0, 55, 20, lwd = 2, col = lgrey) > rect(40, 0, 55, 20, lwd = 2, col = lgrey) > rect(60, 0, 80, 20, col = lgrey) > rect(70, 0, 80, 20, col = dgrey) > rect(60, 0, 80, 20, lwd = 2) > text(57.5, 100, "fitted model object\n(class: foo)") > text(25, 50, "estfun") > text(35, 50, "foo") > text(12.5, 10, "meatHC") > text(30, 10, "meatHAC") > text(47.5, 10, "meat") > text(65, 10, "bread") > text(75, 10, "foo") > arrows(57.5, 89, 70, 21, lwd = 1.5, length = 0.15, + angle = 20) > arrows(57.5, 89, 30, 61, lwd = 1.5, length = 0.15, + angle = 20) > arrows(30, 39, 30, 21, lwd = 1.5, length = 0.15, angle = 20) > arrows(30, 39, 12.5, 21, lwd = 1.5, length = 0.15, + angle = 20) > arrows(30, 39, 47.5, 21, lwd = 1.5, length = 0.15, + angle = 20) > suppressWarnings(RNGversion("3.5.0")) > set.seed(123) > x <- rnorm(250) > y <- rnbinom(250, mu = exp(1 + x), size = 1) > fm_pois <- glm(y ~ x + I(x^2), family = poisson) > coeftest(fm_pois) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 1.063268 0.041357 25.7094 < 2e-16 *** x 0.996072 0.053534 18.6062 < 2e-16 *** I(x^2) -0.049124 0.023146 -2.1223 0.03381 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > coeftest(fm_pois, vcov = sandwich) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 1.063268 0.083776 12.6918 <2e-16 *** x 0.996072 0.105217 9.4668 <2e-16 *** I(x^2) -0.049124 0.036284 -1.3539 0.1758 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > fm_qpois <- glm(y ~ x + I(x^2), family = quasipoisson) > coeftest(fm_qpois) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 1.063268 0.090435 11.7572 <2e-16 *** x 0.996072 0.117063 8.5088 <2e-16 *** I(x^2) -0.049124 0.050613 -0.9706 0.3318 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > fm_nbin <- glm.nb(y ~ x + I(x^2)) > coeftest(fm_nbin) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 1.066057 0.088574 12.0358 <2e-16 *** x 0.999616 0.094894 10.5340 <2e-16 *** I(x^2) -0.052652 0.064883 -0.8115 0.4171 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > if (require("AER")) { + library("AER") + data("Affairs", package = "AER") + fm_tobit <- tobit(affairs ~ age + yearsmarried + religiousne .... [TRUNCATED] > coeftest(fm_tobit) z test of coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 8.174197 2.741446 2.9817 0.002866 ** age -0.179333 0.079093 -2.2674 0.023368 * yearsmarried 0.554142 0.134518 4.1195 3.798e-05 *** religiousness -1.686220 0.403752 -4.1764 2.962e-05 *** occupation 0.326053 0.254425 1.2815 0.200007 rating -2.284973 0.407828 -5.6028 2.109e-08 *** Log(scale) 2.109859 0.067098 31.4444 < 2.2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > coeftest(fm_tobit, vcov = sandwich) When sourcing ‘sandwich-OOP.R’: Error: model frame and formula mismatch in model.matrix() Execution halted ‘sandwich-CL.Rnw’... [7s/7s] OK ‘sandwich-OOP.Rnw’... failed ‘sandwich.Rnw’... [1s/1s] OK Package: tern Check: tests New result: ERROR Running ‘testthat.R’ [175s/177s] Running the tests in ‘tests/testthat.R’ failed. Complete output: > pkg_name <- "tern" > library(testthat) > test_check(pkg_name, reporter = ParallelProgressReporter$new()) Loading required package: tern Loading required package: rtables Loading required package: formatters Attaching package: 'formatters' The following object is masked from 'package:base': %||% Loading required package: magrittr Attaching package: 'magrittr' The following objects are masked from 'package:testthat': equals, is_less_than, not Attaching package: 'rtables' The following object is masked from 'package:utils': str Registered S3 method overwritten by 'tern': method from tidy.glm broom Attaching package: 'dplyr' The following object is masked from 'package:testthat': matches The following objects are masked from 'package:stats': filter, lag The following objects are masked from 'package:base': intersect, setdiff, setequal, union ✔ | F W S OK | Context ⠋ [ FAIL 0 | WARN 0 | SKIP 0 | PASS 0 ] Starting up... ✔ | 7 7 | abnormal [1.6s] ✔ | 5 8 | abnormal_by_baseline [1.1s] ✔ | 3 4 | abnormal_by_marked [5.6s] ✔ | 2 3 | abnormal_by_worst_grade ✔ | 8 12 | abnormal_by_worst_grade_worsen [1.4s] ✔ | 31 47 | analyze_variables [6.0s] ✔ | 7 8 | analyze_vars_in_cols [5.3s] ✔ | 2 6 | bland-altman ✔ | 16 | combination_function ✔ | 9 17 | compare_variables [1.1s] ✔ | 1 3 | control_logistic ✔ | 1 4 | control_step ✔ | 3 11 | control_survival ✔ | 6 6 | count_cumulative ✔ | 5 5 | count_missed_doses ✔ | 8 15 | count_occurrences [1.7s] ✔ | 13 15 | count_occurrences_by_grade [3.1s] ✔ | 4 4 | count_patients_events_in_cols ✔ | 6 6 | count_patients_with_event ✔ | 8 8 | count_patients_with_flags [1.5s] ✔ | 10 10 | count_values skipping term strata(ecog.ps) ✔ | 5 11 | coxph ✖ | 1 24 49 | coxreg [1.6s] ──────────────────────────────────────────────────────────────────────────────── Failure ('test-coxreg.R:563:3'): fit_coxreg_multivar works correctly also without treatment arm stats::formula(result$mod) (`actual`) not equal to survival::Surv(time, status) ~ 1 + covar1 + covar2 (`expected`). `actual`: `Surv(time, status) ~ 1 + covar1 + covar2` `expected`: `survival::Surv(time, status) ~ 1 + covar1 + covar2` ──────────────────────────────────────────────────────────────────────────────── ✔ | 2 13 | decorate_grob [1.7s] ✔ | 5 5 | desctools_binom_diff ✔ | 5 12 | df_explicit_na ✔ | 3 7 | estimate_multinom_rsp ✔ | 17 17 | estimate_proportion ✔ | 3 13 | fit_rsp_step ✔ | 3 9 | fit_survival_step ✔ | 21 33 | formatting_functions ✔ | 3 18 | g_forest [8.5s] ✔ | 9 18 | g_km [11.1s] ✔ | 6 11 | g_lineplot [7.2s] ✔ | 4 10 | g_step ✔ | 2 2 | g_waterfall ✔ | 5 1 | h_adsl_adlb_merge_using_worst_flag ✔ | 1 1 | h_format_row ✔ | 5 5 | h_incidence_rate ✔ | 13 21 | h_km [1.3s] ✔ | 16 38 | h_logistic_regression ✔ | 7 7 | h_map_for_count_abnormal ✔ | 2 2 | h_pkparam_sort ✔ | 5 5 | h_response_biomarkers_subgroups ✔ | 14 15 | h_response_subgroups ✔ | 3 5 | h_stack_by_baskets ✔ | 8 43 | h_step ✔ | 4 8 | h_survival_biomarkers_subgroups ✔ | 16 17 | h_survival_duration_subgroups [1.0s] ✔ | 2 0 | imputation_rule ✔ | 8 12 | incidence_rate [1.1s] ✔ | 7 | individual_patient_plot ✔ | 6 21 | logistic_regression [4.2s] ✔ | 7 19 | make_afun ✔ | 7 8 | odds_ratio ✔ | 11 19 | prop_diff ✔ | 7 14 | prune_occurrences [4.7s] ✔ | 6 10 | response_biomarkers_subgroups [3.3s] ✔ | 14 16 | response_subgroups [9.9s] ✔ | 5 8 | rtables_access [3.4s] ✔ | 5 8 | score_occurrences [1.7s] ✔ | 15 19 | split_cols_by_groups [1.0s] ✔ | 9 11 | stat ✔ | 5 11 | summarize_ancova [1.5s] ✔ | 4 4 | summarize_change ✔ | 3 3 | summarize_colvars [1.4s] ✔ | 13 15 | summarize_coxreg [6.6s] ✔ | 17 25 | summarize_glm_count [3.2s] ✔ | 16 16 | summarize_num_patients [2.3s] ✔ | 9 9 | summarize_patients_exposure_in_cols [1.7s] ✔ | 7 10 | survival_biomarkers_subgroups [5.0s] ✔ | 8 9 | survival_coxph_pairwise [1.2s] ✔ | 14 17 | survival_duration_subgroups [10.0s] ✔ | 7 9 | survival_time ✔ | 10 11 | survival_timepoint [1.2s] ✔ | 11 12 | test_proportion_diff ✔ | 59 79 | utils [1.5s] ✔ | 42 | utils_checkmate ✔ | 6 24 | utils_default_stats_formats_labels ✔ | 13 26 | utils_factor ✔ | 3 3 | utils_ggplot [2.4s] ✔ | 8 | utils_grid ✔ | 19 24 | utils_rtables [8.1s] ✔ | 6 13 | utils_split_fun [2.8s] ══ Results ═════════════════════════════════════════════════════════════════════ Duration: 158.8 s ── Skipped tests (682) ───────────────────────────────────────────────────────── • On CRAN (682): 'test-abnormal.R:24:3', 'test-abnormal.R:51:3', 'test-abnormal.R:80:3', 'test-abnormal.R:103:3', 'test-abnormal.R:134:3', 'test-abnormal.R:160:3', 'test-abnormal.R:186:3', 'test-abnormal_by_baseline.R:16:3', 'test-abnormal_by_baseline.R:46:3', 'test-abnormal_by_baseline.R:80:3', 'test-abnormal_by_baseline.R:94:3', 'test-abnormal_by_baseline.R:113:3', 'test-abnormal_by_marked.R:80:3', 'test-abnormal_by_marked.R:135:3', 'test-abnormal_by_marked.R:254:3', 'test-abnormal_by_worst_grade.R:43:3', 'test-abnormal_by_worst_grade.R:71:3', 'test-abnormal_by_worst_grade_worsen.R:64:3', 'test-abnormal_by_worst_grade_worsen.R:82:3', 'test-abnormal_by_worst_grade_worsen.R:102:3', 'test-abnormal_by_worst_grade_worsen.R:122:3', 'test-abnormal_by_worst_grade_worsen.R:142:3', 'test-abnormal_by_worst_grade_worsen.R:162:3', 'test-abnormal_by_worst_grade_worsen.R:184:3', 'test-abnormal_by_worst_grade_worsen.R:211:3', 'test-analyze_variables.R:7:3', 'test-analyze_variables.R:17:3', 'test-analyze_variables.R:31:3', 'test-analyze_variables.R:39:3', 'test-analyze_variables.R:48:3', 'test-analyze_variables.R:62:3', 'test-analyze_variables.R:72:3', 'test-analyze_variables.R:81:3', 'test-analyze_variables.R:90:3', 'test-analyze_variables.R:113:3', 'test-analyze_variables.R:127:3', 'test-analyze_variables.R:134:3', 'test-analyze_variables.R:143:3', 'test-analyze_variables.R:152:3', 'test-analyze_variables.R:171:3', 'test-analyze_variables.R:228:3', 'test-analyze_variables.R:245:3', 'test-analyze_variables.R:275:3', 'test-analyze_variables.R:295:3', 'test-analyze_variables.R:310:3', 'test-analyze_variables.R:321:3', 'test-analyze_variables.R:332:3', 'test-analyze_variables.R:343:3', 'test-analyze_variables.R:378:3', 'test-analyze_variables.R:389:3', 'test-analyze_variables.R:437:3', 'test-analyze_variables.R:448:3', 'test-analyze_variables.R:474:3', 'test-analyze_variables.R:492:3', 'test-analyze_variables.R:502:3', 'test-analyze_variables.R:521:3', 'test-analyze_vars_in_cols.R:11:3', 'test-analyze_vars_in_cols.R:53:3', 'test-analyze_vars_in_cols.R:105:3', 'test-analyze_vars_in_cols.R:180:3', 'test-analyze_vars_in_cols.R:251:3', 'test-analyze_vars_in_cols.R:319:3', 'test-analyze_vars_in_cols.R:422:3', 'test-bland-altman.R:79:3', 'test-bland-altman.R:103:3', 'test-compare_variables.R:9:3', 'test-compare_variables.R:20:3', 'test-compare_variables.R:29:3', 'test-compare_variables.R:47:3', 'test-compare_variables.R:69:3', 'test-compare_variables.R:78:3', 'test-compare_variables.R:100:3', 'test-compare_variables.R:115:3', 'test-compare_variables.R:125:3', 'test-control_logistic.R:8:3', 'test-control_step.R:5:3', 'test-control_survival.R:7:3', 'test-control_survival.R:21:3', 'test-control_survival.R:36:3', 'test-count_cumulative.R:12:3', 'test-count_cumulative.R:30:3', 'test-count_cumulative.R:44:3', 'test-count_cumulative.R:62:3', 'test-count_cumulative.R:81:3', 'test-count_cumulative.R:103:3', 'test-count_missed_doses.R:8:3', 'test-count_missed_doses.R:17:3', 'test-count_missed_doses.R:24:3', 'test-count_missed_doses.R:35:3', 'test-count_missed_doses.R:55:3', 'test-count_occurrences.R:10:3', 'test-count_occurrences.R:65:3', 'test-count_occurrences.R:109:3', 'test-count_occurrences.R:135:3', 'test-count_occurrences.R:161:3', 'test-count_occurrences.R:175:3', 'test-count_occurrences.R:230:3', 'test-count_occurrences.R:245:3', 'test-count_occurrences_by_grade.R:26:3', 'test-count_occurrences_by_grade.R:40:3', 'test-count_occurrences_by_grade.R:48:3', 'test-count_occurrences_by_grade.R:67:3', 'test-count_occurrences_by_grade.R:84:3', 'test-count_occurrences_by_grade.R:135:3', 'test-count_occurrences_by_grade.R:149:3', 'test-count_occurrences_by_grade.R:174:3', 'test-count_occurrences_by_grade.R:200:3', 'test-count_occurrences_by_grade.R:235:3', 'test-count_occurrences_by_grade.R:282:3', 'test-count_occurrences_by_grade.R:314:3', 'test-count_occurrences_by_grade.R:397:3', 'test-count_patients_events_in_cols.R:23:3', 'test-count_patients_events_in_cols.R:39:3', 'test-count_patients_events_in_cols.R:55:3', 'test-count_patients_events_in_cols.R:75:3', 'test-count_patients_with_event.R:14:3', 'test-count_patients_with_event.R:31:3', 'test-count_patients_with_event.R:63:3', 'test-count_patients_with_event.R:101:3', 'test-count_patients_with_event.R:121:3', 'test-count_patients_with_event.R:137:3', 'test-count_patients_with_flags.R:14:3', 'test-count_patients_with_flags.R:31:3', 'test-count_patients_with_flags.R:52:3', 'test-count_patients_with_flags.R:130:3', 'test-count_patients_with_flags.R:178:3', 'test-count_patients_with_flags.R:217:3', 'test-count_patients_with_flags.R:243:3', 'test-count_patients_with_flags.R:320:3', 'test-count_values.R:8:3', 'test-count_values.R:24:3', 'test-count_values.R:39:3', 'test-count_values.R:47:3', 'test-count_values.R:55:3', 'test-count_values.R:64:3', 'test-count_values.R:81:3', 'test-count_values.R:91:3', 'test-count_values.R:101:3', 'test-count_values.R:118:3', 'test-coxph.R:5:3', 'test-coxph.R:17:3', 'test-coxph.R:41:3', 'test-coxph.R:56:3', 'test-coxph.R:108:3', 'test-coxreg.R:44:3', 'test-coxreg.R:56:3', 'test-coxreg.R:67:3', 'test-coxreg.R:80:3', 'test-coxreg.R:92:3', 'test-coxreg.R:124:3', 'test-coxreg.R:136:3', 'test-coxreg.R:147:3', 'test-coxreg.R:158:3', 'test-coxreg.R:170:3', 'test-coxreg.R:182:3', 'test-coxreg.R:193:3', 'test-coxreg.R:204:3', 'test-coxreg.R:216:3', 'test-coxreg.R:225:3', 'test-coxreg.R:248:3', 'test-coxreg.R:298:3', 'test-coxreg.R:309:3', 'test-coxreg.R:320:3', 'test-coxreg.R:360:3', 'test-coxreg.R:374:3', 'test-coxreg.R:388:3', 'test-coxreg.R:533:3', 'test-coxreg.R:585:3', 'test-decorate_grob.R:55:3', 'test-decorate_grob.R:124:3', 'test-desctools_binom_diff.R:18:3', 'test-desctools_binom_diff.R:33:3', 'test-desctools_binom_diff.R:42:3', 'test-desctools_binom_diff.R:51:3', 'test-desctools_binom_diff.R:63:3', 'test-df_explicit_na.R:22:3', 'test-df_explicit_na.R:36:3', 'test-df_explicit_na.R:44:3', 'test-df_explicit_na.R:57:3', 'test-df_explicit_na.R:70:3', 'test-estimate_multinom_rsp.R:6:3', 'test-estimate_multinom_rsp.R:14:3', 'test-estimate_multinom_rsp.R:48:3', 'test-estimate_proportion.R:9:3', 'test-estimate_proportion.R:29:3', 'test-estimate_proportion.R:43:3', 'test-estimate_proportion.R:78:3', 'test-estimate_proportion.R:106:3', 'test-estimate_proportion.R:131:3', 'test-estimate_proportion.R:142:3', 'test-estimate_proportion.R:154:3', 'test-estimate_proportion.R:170:3', 'test-estimate_proportion.R:181:3', 'test-estimate_proportion.R:203:3', 'test-estimate_proportion.R:210:3', 'test-estimate_proportion.R:223:3', 'test-estimate_proportion.R:247:3', 'test-estimate_proportion.R:281:3', 'test-estimate_proportion.R:307:3', 'test-estimate_proportion.R:339:5', 'test-fit_rsp_step.R:29:3', 'test-fit_rsp_step.R:58:3', 'test-fit_rsp_step.R:85:3', 'test-fit_survival_step.R:34:3', 'test-fit_survival_step.R:65:3', 'test-fit_survival_step.R:88:3', 'test-formatting_functions.R:5:3', 'test-formatting_functions.R:12:3', 'test-formatting_functions.R:19:3', 'test-formatting_functions.R:26:3', 'test-formatting_functions.R:33:3', 'test-formatting_functions.R:40:3', 'test-formatting_functions.R:47:3', 'test-formatting_functions.R:59:3', 'test-formatting_functions.R:66:3', 'test-formatting_functions.R:73:3', 'test-formatting_functions.R:82:3', 'test-formatting_functions.R:91:3', 'test-formatting_functions.R:116:3', 'test-formatting_functions.R:125:3', 'test-formatting_functions.R:134:3', 'test-formatting_functions.R:150:3', 'test-formatting_functions.R:158:3', 'test-formatting_functions.R:172:3', 'test-formatting_functions.R:181:3', 'test-formatting_functions.R:190:3', 'test-formatting_functions.R:252:3', 'test-g_forest.R:23:3', 'test-g_forest.R:58:3', 'test-g_forest.R:98:3', 'test-g_km.R:15:3', 'test-g_km.R:28:3', 'test-g_km.R:40:3', 'test-g_km.R:62:3', 'test-g_km.R:77:3', 'test-g_km.R:114:3', 'test-g_km.R:128:3', 'test-g_km.R:147:3', 'test-g_km.R:162:3', 'test-g_lineplot.R:9:3', 'test-g_lineplot.R:30:3', 'test-g_lineplot.R:50:3', 'test-g_lineplot.R:69:3', 'test-g_lineplot.R:99:3', 'test-g_lineplot.R:112:3', 'test-g_step.R:18:3', 'test-g_step.R:28:3', 'test-g_step.R:36:3', 'test-g_step.R:65:3', 'test-g_waterfall.R:7:3', 'test-g_waterfall.R:29:3', 'test-h_adsl_adlb_merge_using_worst_flag.R:11:3', 'test-h_adsl_adlb_merge_using_worst_flag.R:25:3', 'test-h_adsl_adlb_merge_using_worst_flag.R:39:3', 'test-h_adsl_adlb_merge_using_worst_flag.R:55:5', 'test-h_adsl_adlb_merge_using_worst_flag.R:68:3', 'test-h_format_row.R:11:3', 'test-h_incidence_rate.R:5:3', 'test-h_incidence_rate.R:12:3', 'test-h_incidence_rate.R:19:3', 'test-h_incidence_rate.R:26:3', 'test-h_incidence_rate.R:37:3', 'test-h_km.R:11:3', 'test-h_km.R:18:3', 'test-h_km.R:26:3', 'test-h_km.R:34:3', 'test-h_km.R:43:3', 'test-h_km.R:58:3', 'test-h_km.R:68:3', 'test-h_km.R:77:3', 'test-h_km.R:84:3', 'test-h_km.R:99:3', 'test-h_km.R:118:3', 'test-h_km.R:131:3', 'test-h_km.R:143:3', 'test-h_logistic_regression.R:28:3', 'test-h_logistic_regression.R:49:3', 'test-h_logistic_regression.R:74:3', 'test-h_logistic_regression.R:107:3', 'test-h_logistic_regression.R:146:5', 'test-h_logistic_regression.R:204:3', 'test-h_logistic_regression.R:218:3', 'test-h_logistic_regression.R:230:3', 'test-h_logistic_regression.R:247:3', 'test-h_logistic_regression.R:283:3', 'test-h_logistic_regression.R:300:3', 'test-h_logistic_regression.R:317:3', 'test-h_logistic_regression.R:336:3', 'test-h_logistic_regression.R:373:3', 'test-h_logistic_regression.R:395:3', 'test-h_logistic_regression.R:442:3', 'test-h_map_for_count_abnormal.R:27:3', 'test-h_map_for_count_abnormal.R:49:3', 'test-h_map_for_count_abnormal.R:71:5', 'test-h_map_for_count_abnormal.R:98:5', 'test-h_map_for_count_abnormal.R:125:5', 'test-h_map_for_count_abnormal.R:154:5', 'test-h_map_for_count_abnormal.R:182:5', 'test-h_pkparam_sort.R:6:3', 'test-h_pkparam_sort.R:17:3', 'test-h_response_biomarkers_subgroups.R:27:3', 'test-h_response_biomarkers_subgroups.R:51:3', 'test-h_response_biomarkers_subgroups.R:69:3', 'test-h_response_biomarkers_subgroups.R:92:3', 'test-h_response_biomarkers_subgroups.R:120:3', 'test-h_response_subgroups.R:28:3', 'test-h_response_subgroups.R:38:3', 'test-h_response_subgroups.R:55:3', 'test-h_response_subgroups.R:67:3', 'test-h_response_subgroups.R:79:3', 'test-h_response_subgroups.R:98:3', 'test-h_response_subgroups.R:108:3', 'test-h_response_subgroups.R:122:3', 'test-h_response_subgroups.R:141:3', 'test-h_response_subgroups.R:155:3', 'test-h_response_subgroups.R:167:3', 'test-h_response_subgroups.R:179:3', 'test-h_response_subgroups.R:201:3', 'test-h_response_subgroups.R:224:3', 'test-h_stack_by_baskets.R:9:3', 'test-h_stack_by_baskets.R:48:5', 'test-h_stack_by_baskets.R:76:5', 'test-h_step.R:30:3', 'test-h_step.R:56:3', 'test-h_step.R:124:3', 'test-h_step.R:193:3', 'test-h_step.R:240:3', 'test-h_step.R:310:3', 'test-h_step.R:435:3', 'test-h_step.R:476:3', 'test-h_survival_biomarkers_subgroups.R:37:3', 'test-h_survival_biomarkers_subgroups.R:57:3', 'test-h_survival_biomarkers_subgroups.R:75:3', 'test-h_survival_biomarkers_subgroups.R:103:3', 'test-h_survival_duration_subgroups.R:35:3', 'test-h_survival_duration_subgroups.R:55:3', 'test-h_survival_duration_subgroups.R:75:3', 'test-h_survival_duration_subgroups.R:102:3', 'test-h_survival_duration_subgroups.R:124:3', 'test-h_survival_duration_subgroups.R:139:3', 'test-h_survival_duration_subgroups.R:151:3', 'test-h_survival_duration_subgroups.R:170:3', 'test-h_survival_duration_subgroups.R:183:3', 'test-h_survival_duration_subgroups.R:198:3', 'test-h_survival_duration_subgroups.R:212:3', 'test-h_survival_duration_subgroups.R:226:3', 'test-h_survival_duration_subgroups.R:238:3', 'test-h_survival_duration_subgroups.R:263:3', 'test-h_survival_duration_subgroups.R:275:3', 'test-h_survival_duration_subgroups.R:294:3', 'test-imputation_rule.R:13:3', 'test-imputation_rule.R:31:3', 'test-incidence_rate.R:19:3', 'test-incidence_rate.R:43:3', 'test-incidence_rate.R:55:3', 'test-incidence_rate.R:77:3', 'test-incidence_rate.R:90:3', 'test-incidence_rate.R:113:3', 'test-incidence_rate.R:128:3', 'test-incidence_rate.R:150:3', 'test-logistic_regression.R:153:3', 'test-logistic_regression.R:171:3', 'test-logistic_regression.R:198:3', 'test-logistic_regression.R:232:3', 'test-logistic_regression.R:256:3', 'test-logistic_regression.R:276:3', 'test-make_afun.R:35:3', 'test-make_afun.R:88:3', 'test-make_afun.R:122:3', 'test-make_afun.R:170:3', 'test-make_afun.R:214:3', 'test-make_afun.R:238:3', 'test-make_afun.R:266:3', 'test-odds_ratio.R:14:3', 'test-odds_ratio.R:41:3', 'test-odds_ratio.R:58:3', 'test-odds_ratio.R:83:3', 'test-odds_ratio.R:124:3', 'test-odds_ratio.R:145:3', 'test-odds_ratio.R:180:3', 'test-prop_diff.R:9:3', 'test-prop_diff.R:30:3', 'test-prop_diff.R:49:3', 'test-prop_diff.R:81:3', 'test-prop_diff.R:120:3', 'test-prop_diff.R:150:3', 'test-prop_diff.R:225:3', 'test-prop_diff.R:246:3', 'test-prop_diff.R:272:3', 'test-prop_diff.R:333:3', 'test-prop_diff.R:357:3', 'test-prune_occurrences.R:57:3', 'test-prune_occurrences.R:72:3', 'test-prune_occurrences.R:94:3', 'test-prune_occurrences.R:112:3', 'test-prune_occurrences.R:127:3', 'test-prune_occurrences.R:142:3', 'test-prune_occurrences.R:164:3', 'test-response_biomarkers_subgroups.R:35:3', 'test-response_biomarkers_subgroups.R:74:3', 'test-response_biomarkers_subgroups.R:103:3', 'test-response_biomarkers_subgroups.R:122:3', 'test-response_biomarkers_subgroups.R:146:3', 'test-response_biomarkers_subgroups.R:165:3', 'test-response_subgroups.R:30:3', 'test-response_subgroups.R:42:3', 'test-response_subgroups.R:62:3', 'test-response_subgroups.R:85:3', 'test-response_subgroups.R:104:3', 'test-response_subgroups.R:124:3', 'test-response_subgroups.R:146:3', 'test-response_subgroups.R:187:3', 'test-response_subgroups.R:207:3', 'test-response_subgroups.R:227:3', 'test-response_subgroups.R:240:3', 'test-response_subgroups.R:261:3', 'test-response_subgroups.R:283:3', 'test-response_subgroups.R:308:3', 'test-rtables_access.R:17:3', 'test-rtables_access.R:49:3', 'test-rtables_access.R:63:3', 'test-rtables_access.R:77:3', 'test-rtables_access.R:91:3', 'test-score_occurrences.R:90:3', 'test-score_occurrences.R:102:3', 'test-score_occurrences.R:113:3', 'test-score_occurrences.R:134:3', 'test-score_occurrences.R:156:3', 'test-split_cols_by_groups.R:11:3', 'test-split_cols_by_groups.R:20:3', 'test-split_cols_by_groups.R:27:3', 'test-split_cols_by_groups.R:34:3', 'test-split_cols_by_groups.R:41:3', 'test-split_cols_by_groups.R:52:3', 'test-split_cols_by_groups.R:68:3', 'test-split_cols_by_groups.R:91:3', 'test-split_cols_by_groups.R:102:3', 'test-split_cols_by_groups.R:120:3', 'test-split_cols_by_groups.R:147:3', 'test-split_cols_by_groups.R:157:3', 'test-split_cols_by_groups.R:166:3', 'test-split_cols_by_groups.R:175:3', 'test-split_cols_by_groups.R:184:3', 'test-stat.R:8:5', 'test-stat.R:36:5', 'test-stat.R:109:5', 'test-stat.R:132:5', 'test-stat.R:202:3', 'test-stat.R:221:3', 'test-stat.R:276:3', 'test-stat.R:287:3', 'test-stat.R:297:3', 'test-summarize_ancova.R:10:3', 'test-summarize_ancova.R:45:3', 'test-summarize_ancova.R:85:3', 'test-summarize_ancova.R:108:3', 'test-summarize_ancova.R:193:3', 'test-summarize_change.R:16:3', 'test-summarize_change.R:34:3', 'test-summarize_change.R:53:3', 'test-summarize_change.R:78:3', 'test-summarize_colvars.R:28:3', 'test-summarize_colvars.R:43:3', 'test-summarize_colvars.R:63:3', 'test-summarize_coxreg.R:36:3', 'test-summarize_coxreg.R:48:3', 'test-summarize_coxreg.R:60:3', 'test-summarize_coxreg.R:76:3', 'test-summarize_coxreg.R:90:3', 'test-summarize_coxreg.R:131:3', 'test-summarize_coxreg.R:145:3', 'test-summarize_coxreg.R:160:3', 'test-summarize_coxreg.R:173:3', 'test-summarize_coxreg.R:185:3', 'test-summarize_coxreg.R:199:3', 'test-summarize_coxreg.R:215:3', 'test-summarize_coxreg.R:243:3', 'test-summarize_glm_count.R:18:3', 'test-summarize_glm_count.R:35:3', 'test-summarize_glm_count.R:73:3', 'test-summarize_glm_count.R:90:3', 'test-summarize_glm_count.R:110:3', 'test-summarize_glm_count.R:126:3', 'test-summarize_glm_count.R:164:3', 'test-summarize_glm_count.R:180:3', 'test-summarize_glm_count.R:219:3', 'test-summarize_glm_count.R:236:3', 'test-summarize_glm_count.R:273:7', 'test-summarize_glm_count.R:322:3', 'test-summarize_glm_count.R:344:3', 'test-summarize_glm_count.R:368:3', 'test-summarize_glm_count.R:392:3', 'test-summarize_glm_count.R:437:3', 'test-summarize_glm_count.R:468:3', 'test-summarize_num_patients.R:6:3', 'test-summarize_num_patients.R:14:3', 'test-summarize_num_patients.R:22:3', 'test-summarize_num_patients.R:33:3', 'test-summarize_num_patients.R:51:3', 'test-summarize_num_patients.R:90:3', 'test-summarize_num_patients.R:99:3', 'test-summarize_num_patients.R:108:3', 'test-summarize_num_patients.R:119:3', 'test-summarize_num_patients.R:130:3', 'test-summarize_num_patients.R:141:3', 'test-summarize_num_patients.R:159:3', 'test-summarize_num_patients.R:209:5', 'test-summarize_num_patients.R:243:3', 'test-summarize_num_patients.R:273:3', 'test-summarize_num_patients.R:302:3', 'test-summarize_patients_exposure_in_cols.R:23:3', 'test-summarize_patients_exposure_in_cols.R:35:3', 'test-summarize_patients_exposure_in_cols.R:49:3', 'test-summarize_patients_exposure_in_cols.R:72:3', 'test-summarize_patients_exposure_in_cols.R:95:5', 'test-summarize_patients_exposure_in_cols.R:109:3', 'test-summarize_patients_exposure_in_cols.R:126:3', 'test-summarize_patients_exposure_in_cols.R:144:5', 'test-summarize_patients_exposure_in_cols.R:166:3', 'test-survival_biomarkers_subgroups.R:36:3', 'test-survival_biomarkers_subgroups.R:65:3', 'test-survival_biomarkers_subgroups.R:85:3', 'test-survival_biomarkers_subgroups.R:105:3', 'test-survival_biomarkers_subgroups.R:129:3', 'test-survival_biomarkers_subgroups.R:153:3', 'test-survival_biomarkers_subgroups.R:178:3', 'test-survival_coxph_pairwise.R:18:3', 'test-survival_coxph_pairwise.R:39:3', 'test-survival_coxph_pairwise.R:59:3', 'test-survival_coxph_pairwise.R:80:3', 'test-survival_coxph_pairwise.R:102:3', 'test-survival_coxph_pairwise.R:125:3', 'test-survival_coxph_pairwise.R:147:3', 'test-survival_coxph_pairwise.R:172:3', 'test-survival_duration_subgroups.R:33:3', 'test-survival_duration_subgroups.R:52:3', 'test-survival_duration_subgroups.R:68:3', 'test-survival_duration_subgroups.R:87:3', 'test-survival_duration_subgroups.R:102:3', 'test-survival_duration_subgroups.R:117:3', 'test-survival_duration_subgroups.R:134:3', 'test-survival_duration_subgroups.R:153:3', 'test-survival_duration_subgroups.R:175:3', 'test-survival_duration_subgroups.R:210:3', 'test-survival_duration_subgroups.R:229:3', 'test-survival_duration_subgroups.R:249:3', 'test-survival_duration_subgroups.R:267:3', 'test-survival_duration_subgroups.R:288:3', 'test-survival_time.R:16:3', 'test-survival_time.R:37:3', 'test-survival_time.R:56:3', 'test-survival_time.R:83:3', 'test-survival_time.R:106:3', 'test-survival_time.R:129:3', 'test-survival_time.R:154:3', 'test-survival_timepoint.R:17:3', 'test-survival_timepoint.R:39:3', 'test-survival_timepoint.R:61:3', 'test-survival_timepoint.R:86:3', 'test-survival_timepoint.R:112:3', 'test-survival_timepoint.R:137:3', 'test-survival_timepoint.R:162:3', 'test-survival_timepoint.R:188:3', 'test-survival_timepoint.R:215:3', 'test-survival_timepoint.R:238:3', 'test-test_proportion_diff.R:12:3', 'test-test_proportion_diff.R:24:3', 'test-test_proportion_diff.R:49:3', 'test-test_proportion_diff.R:63:3', 'test-test_proportion_diff.R:89:3', 'test-test_proportion_diff.R:113:3', 'test-test_proportion_diff.R:133:3', 'test-test_proportion_diff.R:151:3', 'test-test_proportion_diff.R:169:3', 'test-test_proportion_diff.R:189:3', 'test-test_proportion_diff.R:211:3', 'test-utils.R:5:3', 'test-utils.R:17:3', 'test-utils.R:30:3', 'test-utils.R:37:3', 'test-utils.R:57:3', 'test-utils.R:65:3', 'test-utils.R:73:3', 'test-utils.R:96:3', 'test-utils.R:105:3', 'test-utils.R:113:3', 'test-utils.R:121:3', 'test-utils.R:167:3', 'test-utils.R:182:3', 'test-utils.R:191:3', 'test-utils.R:202:5', 'test-utils.R:212:3', 'test-utils.R:223:3', 'test-utils.R:234:5', 'test-utils.R:246:5', 'test-utils.R:256:3', 'test-utils.R:267:3', 'test-utils.R:278:5', 'test-utils.R:290:5', 'test-utils.R:300:3', 'test-utils.R:311:3', 'test-utils.R:322:5', 'test-utils.R:334:5', 'test-utils.R:344:3', 'test-utils.R:355:3', 'test-utils.R:366:5', 'test-utils.R:378:5', 'test-utils.R:388:3', 'test-utils.R:399:3', 'test-utils.R:410:5', 'test-utils.R:422:5', 'test-utils.R:434:5', 'test-utils.R:446:3', 'test-utils.R:457:5', 'test-utils.R:469:5', 'test-utils.R:481:5', 'test-utils.R:504:5', 'test-utils.R:516:5', 'test-utils.R:528:5', 'test-utils.R:540:3', 'test-utils.R:551:5', 'test-utils.R:563:5', 'test-utils.R:573:3', 'test-utils.R:584:3', 'test-utils.R:595:5', 'test-utils.R:607:5', 'test-utils.R:619:5', 'test-utils.R:631:3', 'test-utils.R:642:5', 'test-utils.R:654:5', 'test-utils.R:666:5', 'test-utils.R:678:3', 'test-utils.R:689:5', 'test-utils.R:701:5', 'test-utils.R:713:5', 'test-utils_default_stats_formats_labels.R:4:3', 'test-utils_default_stats_formats_labels.R:108:3', 'test-utils_default_stats_formats_labels.R:159:3', 'test-utils_default_stats_formats_labels.R:194:3', 'test-utils_default_stats_formats_labels.R:207:3', 'test-utils_default_stats_formats_labels.R:217:3', 'test-utils_factor.R:25:3', 'test-utils_factor.R:36:3', 'test-utils_factor.R:51:3', 'test-utils_factor.R:58:3', 'test-utils_factor.R:74:3', 'test-utils_factor.R:86:3', 'test-utils_factor.R:97:3', 'test-utils_factor.R:115:3', 'test-utils_factor.R:138:3', 'test-utils_factor.R:149:3', 'test-utils_factor.R:159:3', 'test-utils_factor.R:167:3', 'test-utils_factor.R:175:3', 'test-utils_ggplot.R:19:3', 'test-utils_ggplot.R:53:3', 'test-utils_ggplot.R:59:3', 'test-utils_rtables.R:14:3', 'test-utils_rtables.R:44:3', 'test-utils_rtables.R:52:3', 'test-utils_rtables.R:66:3', 'test-utils_rtables.R:71:3', 'test-utils_rtables.R:87:3', 'test-utils_rtables.R:94:3', 'test-utils_rtables.R:104:3', 'test-utils_rtables.R:119:3', 'test-utils_rtables.R:132:3', 'test-utils_rtables.R:159:3', 'test-utils_rtables.R:169:3', 'test-utils_rtables.R:181:3', 'test-utils_rtables.R:202:3', 'test-utils_rtables.R:215:3', 'test-utils_rtables.R:228:3', 'test-utils_rtables.R:235:3', 'test-utils_rtables.R:249:3', 'test-utils_rtables.R:261:3', 'test-utils_split_fun.R:27:3', 'test-utils_split_fun.R:39:3', 'test-utils_split_fun.R:56:3', 'test-utils_split_fun.R:74:3', 'test-utils_split_fun.R:102:3', 'test-utils_split_fun.R:124:3' ── Failed tests ──────────────────────────────────────────────────────────────── Failure ('test-coxreg.R:563:3'): fit_coxreg_multivar works correctly also without treatment arm stats::formula(result$mod) (`actual`) not equal to survival::Surv(time, status) ~ 1 + covar1 + covar2 (`expected`). `actual`: `Surv(time, status) ~ 1 + covar1 + covar2` `expected`: `survival::Surv(time, status) ~ 1 + covar1 + covar2` [ FAIL 1 | WARN 0 | SKIP 682 | PASS 1153 ] Deleting unused snapshots: • estimate_incidence_rate.md • g_forest/g_forest_custom_2.new.svg • g_forest/g_forest_custom_2.svg • g_forest/g_forest_custom_3.new.svg • g_forest/g_forest_custom_3.svg • g_forest/g_forest_or.new.svg • g_forest/g_forest_or.svg • g_forest/g_forest_plot_only.new.svg • g_forest/g_forest_plot_only.svg • g_km/g_km_crop_ylim_failure.new.svg • g_km/g_km_crop_ylim_failure.svg • g_km/g_km_custom_ylim.new.svg • g_km/g_km_custom_ylim.svg • g_km/g_km_table_only.new.svg • g_km/g_km_table_only.svg • g_lineplot/g_lineplot_xlim_ylim.svg • g_lineplot/g_lineplot_xticks.svg • utils_ggplot/df2gg_cw.svg • utils_ggplot/df2gg_fs.svg • utils_ggplot/rtable2gg_cw.svg • utils_ggplot/rtable2gg_fs.svg • utils_ggplot/rtable2gg_lblpad.svg Error: Test failures Execution halted