Exam5.1 is used to show polynomial multiple regression with binomial response

References

  1. Stroup, W. W. (2012). Generalized Linear Mixed Models: Modern Concepts, Methods and Applications. CRC Press.

See also

Examples

##---Sequential Fit of the logit Model Exam5.1.glm.1 <- glm( formula = F/N~ X , family = quasibinomial(link = "logit") , data = DataSet5.1 , weights = NULL # , subset # , na.action , start = NULL # , etastart # , mustart # , offset # , control = list(...) # , model = TRUE , method = "glm.fit" # , x = FALSE # , y = TRUE , contrasts = NULL # , ... ) summary(Exam5.1.glm.1)
#> #> Call: #> glm(formula = F/N ~ X, family = quasibinomial(link = "logit"), #> data = DataSet5.1, weights = NULL, start = NULL, method = "glm.fit", #> contrasts = NULL) #> #> Deviance Residuals: #> Min 1Q Median 3Q Max #> -0.76691 -0.22615 -0.02469 0.33388 0.69423 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 0.24519 0.33246 0.738 0.475 #> X 0.04325 0.04178 1.035 0.321 #> #> (Dispersion parameter for quasibinomial family taken to be 0.1700061) #> #> Null deviance: 2.2947 on 13 degrees of freedom #> Residual deviance: 2.1078 on 12 degrees of freedom #> AIC: NA #> #> Number of Fisher Scoring iterations: 3 #>
## confint.default() produce Wald Confidence interval as SAS produces ##---Likelihood Ratio test for Model 1 (LRExam5.1.glm.1 <- anova( object = Exam5.1.glm.1 , test = "Chisq") )
#> Analysis of Deviance Table #> #> Model: quasibinomial, link: logit #> #> Response: F/N #> #> Terms added sequentially (first to last) #> #> #> Df Deviance Resid. Df Resid. Dev Pr(>Chi) #> NULL 13 2.2947 #> X 1 0.18694 12 2.1078 0.2944
library(aod) WaldExam5.1.glm.1 <- wald.test( Sigma = vcov(object=Exam5.1.glm.1) , b = coef(object=Exam5.1.glm.1) , Terms = 2 , L = NULL , H0 = NULL , df = NULL , verbose = FALSE ) ##---Sequential Fit of the logit Model quadratic terms involved Exam5.1.glm.2 <- glm( formula = F/N~ X + I(X^2) , family = quasibinomial(link = "logit") , data = DataSet5.1 , weights = NULL # , subset # , na.action , start = NULL # , etastart # , mustart # , offset # , control = list(...) # , model = TRUE , method = "glm.fit" # , x = FALSE # , y = TRUE , contrasts = NULL # , ... ) summary( Exam5.1.glm.2 )
#> #> Call: #> glm(formula = F/N ~ X + I(X^2), family = quasibinomial(link = "logit"), #> data = DataSet5.1, weights = NULL, start = NULL, method = "glm.fit", #> contrasts = NULL) #> #> Deviance Residuals: #> Min 1Q Median 3Q Max #> -0.3909 -0.1442 0.1181 0.1454 0.2851 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) -0.490760 0.259704 -1.890 0.085427 . #> X 0.511312 0.107904 4.739 0.000611 *** #> I(X^2) -0.029975 0.006617 -4.530 0.000858 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> (Dispersion parameter for quasibinomial family taken to be 0.06293754) #> #> Null deviance: 2.29474 on 13 degrees of freedom #> Residual deviance: 0.69489 on 11 degrees of freedom #> AIC: NA #> #> Number of Fisher Scoring iterations: 4 #>
##---Likelihood Ratio test for Model Exam5.1.glm.2 (LRExam5.1.glm.2 <- anova( object = Exam5.1.glm.2 , test = "Chisq") )
#> Analysis of Deviance Table #> #> Model: quasibinomial, link: logit #> #> Response: F/N #> #> Terms added sequentially (first to last) #> #> #> Df Deviance Resid. Df Resid. Dev Pr(>Chi) #> NULL 13 2.29474 #> X 1 0.18694 12 2.10780 0.08481 . #> I(X^2) 1 1.41292 11 0.69489 2.157e-06 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
WaldExam5.1.glm.2 <- wald.test( Sigma = vcov(object=Exam5.1.glm.2) , b = coef(object=Exam5.1.glm.2) , Terms = 3 , L = NULL , H0 = NULL , df = NULL , verbose = FALSE ) ##---Sequential Fit of the logit Model 5th power terms involved Exam5.1.glm.3 <- glm( formula = F/N~ X + I(X^2) + I(X^3) + I(X^4) + I(X^5) , family = quasibinomial(link = "logit") , data = DataSet5.1 , weights = NULL # , subset # , na.action , start = NULL # , etastart # , mustart # , offset # , control = list(...) # , model = TRUE , method = "glm.fit" # , x = FALSE # , y = TRUE , contrasts = NULL # , ... ) summary(Exam5.1.glm.3)
#> #> Call: #> glm(formula = F/N ~ X + I(X^2) + I(X^3) + I(X^4) + I(X^5), family = quasibinomial(link = "logit"), #> data = DataSet5.1, weights = NULL, start = NULL, method = "glm.fit", #> contrasts = NULL) #> #> Deviance Residuals: #> Min 1Q Median 3Q Max #> -0.36207 -0.15039 0.03148 0.16145 0.30127 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) -0.2986616 0.3875977 -0.771 0.463 #> X 0.2081471 0.7703070 0.270 0.794 #> I(X^2) 0.0603239 0.4225246 0.143 0.890 #> I(X^3) -0.0120650 0.0821621 -0.147 0.887 #> I(X^4) 0.0008276 0.0064076 0.129 0.900 #> I(X^5) -0.0000223 0.0001714 -0.130 0.900 #> #> (Dispersion parameter for quasibinomial family taken to be 0.07609603) #> #> Null deviance: 2.29474 on 13 degrees of freedom #> Residual deviance: 0.62181 on 8 degrees of freedom #> AIC: NA #> #> Number of Fisher Scoring iterations: 4 #>
## confint.default() produce Wald Confidence interval as SAS produces ##---Likelihood Ratio test for Model 1 (LRExam5.1.glm.3 <- anova( object = Exam5.1.glm.3 , test = "Chisq") )
#> Analysis of Deviance Table #> #> Model: quasibinomial, link: logit #> #> Response: F/N #> #> Terms added sequentially (first to last) #> #> #> Df Deviance Resid. Df Resid. Dev Pr(>Chi) #> NULL 13 2.29474 #> X 1 0.18694 12 2.10780 0.1170 #> I(X^2) 1 1.41292 11 0.69489 1.64e-05 *** #> I(X^3) 1 0.07179 10 0.62310 0.3314 #> I(X^4) 1 0.00000 9 0.62310 0.9952 #> I(X^5) 1 0.00129 8 0.62181 0.8965 #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
WaldExam5.1.glm.3 <- wald.test( Sigma = vcov(object=Exam5.1.glm.3) , b = coef(object=Exam5.1.glm.3) , Terms = 6 , L = NULL , H0 = NULL , df = NULL , verbose = FALSE )