data(api)
dclus2<-svydesign(id=~dnum+snum, weights=~pw, data=apiclus2)
model0<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility, design=dclus2, family=quasibinomial())
model1<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility+as.numeric(stype),
design=dclus2, family=quasibinomial())
model2<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility+stype, design=dclus2, family=quasibinomial())
anova(model2)
anova(model0,model2)
anova(model1, model2)
anova(model1, model2, method="Wald")
AIC(model0,model1, model2)
BIC(model0, model2,maximal=model2)
## AIC for linear model is different because it considers the variance
## parameter
model0<-svyglm(api00~ell+meals+mobility, design=dclus2)
model1<-svyglm(api00~ell+meals+mobility+as.numeric(stype),
design=dclus2)
model2<-svyglm(api00~ell+meals+mobility+stype, design=dclus2)
modelnull<-svyglm(api00~1, design=dclus2)
AIC(model0, model1, model2)
AIC(model0, model1, model2,modelnull, null_has_intercept=FALSE)
## from ?twophase
data(nwtco)
dcchs<-twophase(id=list(~seqno,~seqno), strata=list(NULL,~rel),
subset=~I(in.subcohort | rel), data=nwtco)
a<-svycoxph(Surv(edrel,rel)~factor(stage)+factor(histol)+I(age/12), design=dcchs)
b<-update(a, .~.-I(age/12)+poly(age,3))
## not symbolically nested models
anova(a,b)
Run the code above in your browser using DataLab