Dave Auty
unread,Jun 25, 2009, 5:21:55 AM6/25/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Forest-R, dave...@forestry.gsi.gov.uk
Hello Forest-R users,
Following the modelling steps in Pinheiro and Bates (chapters 6 & 8),
I’m trying to assign an nlsList call to an object using the following
groupedData object (Silviscan data):
>MFA.new <- groupedData(Mean_MFA ~ Disc_Ring_Nr | Tree/Position, data=MFA.data) #12 trees with 5 positions (sample heights) in each tree
Call:
>MFA.lis<-nlsList(Mean_MFA~ b0/(1+exp(b1*Disc_Ring_Nr))+ b2, start=c(b0=30, b1=0.07, b2=9), data = MFA.new)
#But this gives the following (long) error message:
Error in nls(formula = formula, data = data, start = start, control =
control) :
step factor 0.000488281 reduced below 'minFactor' of 0.000976562
Error in nls(formula = formula, data = data, start = start, control =
control) :
number of iterations exceeded maximum of 50
...
Error in nls(formula = formula, data = data, start = start, control =
control) :
singular gradient
#However, if I don’t assign it to an object and just run:
>nlsList(Mean_MFA~ b0/(1+exp(b1*Disc_Ring_Nr))+ b2, start=c(b0=30, b1=0.07, b2=9), data = MFA.new)
The output is normal i.e. parameter estimates are given for all
positions in all 12 trees.
The reason I want to assign it to an object is so I can look at
boxplots of residuals and plot 95% confidence intervals for the
coefficients for the nls object versus the nlsList object, in order to
show the effect of taking the grouping structure into account:
#plot(MFA.lis, Tree ~ resid(.), abline=0, ylab="Tree")
#plot( intervals (MFA.lis) )
There is definitely a “Tree” effect in MFA data and most likely an
effect of “Position” (sample height), hence the grouping structure:
Mean_MFA ~ Disc_Ring_Nr | Tree/Position.
If anyone can spot what’s going wrong your help/comments would be much
appreciated.
Thanks,
Dave