# extract the call for fitting a nls model with 8-parameter double-Richards curve (model 1)
data(posnegRichards.calls)
data(posneg.data)
#for an example just fit a subset of the data, 3 group levels (individuals)
data <- subset(posneg.data, as.numeric(row.names (posneg.data) ) < 40)
modtofit <- as.character( posnegRichards.calls [[2]] [row.names(posnegRichards.calls [[2]]) == "22",] )
#change the data source
modtofit <- sub("posneg.data","data",modtofit)
modtofit <- parse(text = modtofit)
modpar(posneg.data$age, posneg.data$mass, pn.options = "myoptions") #create list for fixed parameters
eval(modtofit)
richardsR22.lis
# view call for model 1
posnegRichards.calls [[1]] [row.names(posnegRichards.calls [[1]]) == "1",]
# view call for model 21
posnegRichards.calls [[2]] [row.names(posnegRichards.calls [[2]]) == "21",]
Run the code above in your browser using DataLab