if (FALSE) {
# The following example will not run because the data are not included in the
# examples. It illustrates the use of rerun.mark with mark.wrapper. With this
# particular data set the POPAN models were having difficulty converging. After
# running the set of models using mark.wrapper and looking at the results it
# was clear that in several instances the model did not converge. This is easiest
# to discern by comparing nested models in the model.table. If one model
# is nested within another,then the deviance of the model with more
# parameters should be as good or better than the smaller model. If that
# is not the case then the model that converged can be used for initial
# values in a call to rerun.mark for the model that did not converge.
#
do.nat=function()
{
Phi.ageclass=list(formula=~ageclass)
Phi.dot=list(formula=~1)
p.area=list(formula=~area)
p.timebin.plus.area=list(formula=~timebin+area)
p.timebin.x.area=list(formula=~-1+timebin:area)
pent.ageclass=list(formula=~ageclass)
pent.ageclass.plus.EN=list(formula=~ageclass+EN)
pent.ageclass.plus.diffEN=list(formula=~ageclass+EN92+EN97+EN02)
cml=create.model.list("POPAN")
nat=mark.wrapper(cml,data=zc.proc,ddl=zc.ddl,
invisible=FALSE,initial=1,retry=2,delete=TRUE)
return(nat)
}
nat=do.nat()
# model list
# Phi p pent
#1 Phi.ageclass p.area pent.ageclass
#2 Phi.ageclass p.area pent.ageclass.plus.diffEN
#3 Phi.ageclass p.area pent.ageclass.plus.EN
#4 Phi.ageclass p.timebin.plus.area pent.ageclass
#5 Phi.ageclass p.timebin.plus.area pent.ageclass.plus.diffEN
#6 Phi.ageclass p.timebin.plus.area pent.ageclass.plus.EN
#7 Phi.ageclass p.timebin.x.area pent.ageclass
#8 Phi.ageclass p.timebin.x.area pent.ageclass.plus.diffEN
#9 Phi.ageclass p.timebin.x.area pent.ageclass.plus.EN
#10 Phi.dot p.area pent.ageclass
#11 Phi.dot p.area pent.ageclass.plus.diffEN
#12 Phi.dot p.area pent.ageclass.plus.EN
#13 Phi.dot p.timebin.plus.area pent.ageclass
#14 Phi.dot p.timebin.plus.area pent.ageclass.plus.diffEN
#15 Phi.dot p.timebin.plus.area pent.ageclass.plus.EN
#16 Phi.dot p.timebin.x.area pent.ageclass
#17 Phi.dot p.timebin.x.area pent.ageclass.plus.diffEN
#18 Phi.dot p.timebin.x.area pent.ageclass.plus.EN
#
# use model 9 as starting values for model 7
nat[[7]]= rerun.mark(nat[[7]],data=zc.proc,ddl=zc.ddl,initial=nat[[9]],delete=TRUE)
# use model 3 as starting values for model 1
nat[[1]]= rerun.mark(nat[[1]],data=zc.proc,ddl=zc.ddl,initial=nat[[3]],delete=TRUE)
# use model 14 as starting values for model 15
nat[[15]]= rerun.mark(nat[[15]],data=zc.proc,ddl=zc.ddl,initial=nat[[14]],delete=TRUE)
# use model 5 as starting values for model 6
nat[[6]]= rerun.mark(nat[[6]],data=zc.proc,ddl=zc.ddl,initial=nat[[5]],delete=TRUE)
# use model 10 as starting values for model 11
nat[[11]]= rerun.mark(nat[[11]],data=zc.proc,ddl=zc.ddl,initial=nat[[10]],delete=TRUE)
# use model 10 as starting values for model 12
nat[[12]]= rerun.mark(nat[[12]],data=zc.proc,ddl=zc.ddl,initial=nat[[10]],delete=TRUE)
# reconstruct model table with new results
nat$model.table=model.table(nat[1:18])
# show new model table
nat
}
Run the code above in your browser using DataLab