Format ChiSqTest from anova of logistic model.

# S3 method for anova
wrapChiSqTest(x, ...)

Arguments

x

result from stats::anova(stats::glm(family=binomial))

...

extra arguments (not used)

Value

list of formatted string and fields

Examples

d <- data.frame(x1= c(1,2,3,4,5,6,7,7), x2= c(1,0,3,0,5,0,7,0), y= c(TRUE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE,FALSE)) model <- glm(y~x1+x2, data=d, family=binomial) summary(model)
#> #> Call: #> glm(formula = y ~ x1 + x2, family = binomial, data = d) #> #> Deviance Residuals: #> 1 2 3 4 5 6 7 8 #> 1.4129 -0.8023 -1.4143 -0.8406 0.6005 1.5073 0.3604 -0.9003 #> #> Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) -1.07841 1.82679 -0.590 0.555 #> x1 0.05496 0.38834 0.142 0.887 #> x2 0.48504 0.41171 1.178 0.239 #> #> (Dispersion parameter for binomial family taken to be 1) #> #> Null deviance: 11.0904 on 7 degrees of freedom #> Residual deviance: 8.9199 on 5 degrees of freedom #> AIC: 14.92 #> #> Number of Fisher Scoring iterations: 4 #>
render(wrapChiSqTest(model), pLargeCutoff=1, format='ascii')
#> [1] "Chi-Square Test summary: pseudo-R2=0.1957 (X2(2,N=8)=2.17, p=0.3378)."
anov <- anova(model) print(anov)
#> Analysis of Deviance Table #> #> Model: binomial, link: logit #> #> Response: y #> #> Terms added sequentially (first to last) #> #> #> Df Deviance Resid. Df Resid. Dev #> NULL 7 11.0904 #> x1 1 0.25309 6 10.8373 #> x2 1 1.91735 5 8.9199
lapply(sigr::wrapChiSqTest(anov), function(ti) { sigr::render(ti, pLargeCutoff= 1, pSmallCutoff= 0, statDigits=4, sigDigits=4, format='ascii') })
#> $x1 #> [1] "Chi-Square Test summary: pseudo-R2=0.02282 (X2(1,N=8)=0.2531, p=0.6149)." #> #> $x2 #> [1] "Chi-Square Test summary: pseudo-R2=0.1957 (X2(2,N=8)=2.17, p=0.3378)." #>