#run model selection for posneg_data object (only first 3 group levels for example's sake)
data(posneg_data)
subdata <- subset(posneg_data, as.numeric(row.names (posneg_data) ) < 40)
modseltable <- pn_mod_compare(subdata$age, subdata$mass,
subdata$id, existing = FALSE)
#fit nlsList model initially and then run model selection
#for posneg_data object when at least one model is already fit
# note forcemod is set to 3 so that models 21-36 are evaluated
richardsR22.lis <- nlsList(mass ~ SSposnegRichards(age, Asym = Asym, K = K,
Infl = Infl, RAsym = RAsym, Rk = Rk, Ri = Ri , modno = 22)
,data = posneg_data)
modseltable <- pn_mod_compare(subdata$age, subdata$mass,
subdata$id, forcemod = 3, existing = TRUE)
#run model selection ranked by residual standard error*sample size
modseltable <- pn_mod_compare(subdata$age, subdata$mass,
subdata$id, penaliz='1*(n)', existing = TRUE)
Run the code above in your browser using DataLab