[R] Nested error structure in nonlinear model

Spencer Graves
Thu, 06 Apr 2006 00:46:52 -0000

Have you read Pinheiro and Bates (2000) Mixed-Effects Models in S and
S-Plus (Springer).  If no, I believe that book should help you.  If you
have access to the library at the University of Waikato, as suggested by
your email address, then I suggest you try the library there.  The
electronic catalog just told me it had a paper copy listed as
"available" as well as an electronic copy.

	  If you have read Pinheiro and Bates, then please prepare another post
more consistent with the posting guide
"www.R-project.org/posting-guide.html".  Pinheiro and Bates and the
documentation for "nlme" contain several examples that should help you
describe succintly where you are encountering difficulties.  If someone
like me can copy a few lines of code from an email, paste it into R and
reproduce what you are seeing in a few seconds, you are much more likely
to get quality help quickly than if I have to guess -- and at least one
of the leading contributors to this list has announced a personal policy
of rarely replying to posts whose style is not consistent with that guide.

	  hope this helps,
	  spencer graves

Murray Jorgensen wrote:

> I am trying to fit a nonlinear regression model to data. There are
> several predictor variables and 8 parameters. I will write the model as
>
> Y ~ Yhat(theta1,...,theta8)
>
> OK, I can do this using nls() - but "only just" as there are not
as many
> observations as might be desired.
>
> Now the problem is that we have a factor "Site" and I want to
include a
> corresponding error component. I tried something like (excuse the
> doctored R output):
>
>  > mod0.nlme <-  nlme(Y ~ Yhat(theta1,...,theta8) + site.err ,
> +                    start = c(mod0.st,0),
> +                    groups = ~ Site,
> +                   fixed = theta1 + ... + theta8 ~ 1,
> +                   random = site.err ~ 1)
> Error in nlme.formula(Y ~ Yhat(theta1,...,theta8  :
>          starting values for the fixed component are not the correct length
>
> and then
>
>  > mod0.nlme <-  nlme(Y ~ Yhat(theta1,...,theta8) + site.err ,
> +                    start = mod0.st,
> +                    groups = ~ Site,
> +                   fixed = theta1 + ... + theta8 ~ 1,
> +                   random = site.err ~ 1)
> Error: Singularity in backsolve at level 0, block 1
>
> The straightforward way would be to go
>
>  > mod0.nlme <-  nlme(Y ~ Yhat(theta1,...,theta8) ,
> +                    start = mod0.st,
> +                    groups = ~ Site,
> +                   fixed = theta1 + ... + theta8 ~ 1)
>
> making all 8 parameters random, but there is little hope of getting that
> to work. (I did try it and it does not crash straight away but settles
> down to run forever.)
>
> Any comments welcome. I regret that I cannot go into much detail about
> the actual problem.
>