Hello, I am trying to fit a nonlinear model of the form of: A*x^b*exp(-c*x) This represents a lactation curve. I have a bunch of cows, so I want COW to be a random effect. I have been trying the following code with very littel success: > fm1 <- nlme(yield ~ A*(DIM^B)*(exp(-C*DIM)), + data = group, + fixed = A + B + C ~ 1, + start = c(A = 20, B = 0.3, C = 0.03)) Does anyone know how to add the random effect of the cow? I have used the command groupedData to have Cow as subject (i.e., yield~DIM | cow). Is this a valid and sufficient approach? I have the feeling it is not sufficient. Also, does anyone know whether the formulation of the fixed effects is correct?. Thank you very much, Alex [[alternative HTML version deleted]]
On 6/30/05, Alex Bach <alex.bach at irta.es> wrote:> Hello, > > I am trying to fit a nonlinear model of the form of: > > A*x^b*exp(-c*x) > > This represents a lactation curve. I have a bunch of cows, so I want > COW to be a random effect.You need to decide which of the model parameters (i.e. A, B and C) should have a random effect grouped by COW and to specify this in your call to nlme.> > I have been trying the following code with very littel success: > > > fm1 <- nlme(yield ~ A*(DIM^B)*(exp(-C*DIM)), > + data = group, > + fixed = A + B + C ~ 1, > + start = c(A = 20, B = 0.3, C = 0.03)) > > Does anyone know how to add the random effect of the cow? I have used > the command groupedData to have Cow as subject (i.e., yield~DIM | > cow). Is this a valid and sufficient approach? I have the feeling it > is not sufficient. > > Also, does anyone know whether the formulation of the fixed effects > is correct?. > > Thank you very much, > > Alex > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! R-project.org/posting-guide.html >