[R-sig-ME] derivative for nlmer
Raquel Souza Dias
rsouza at uoguelph.ca
Wed Nov 3 21:04:25 CET 2010
Hi
I have data on phosphorus intake (avP) and P retention (Pret) of pigs from 11 studies which I consider a random effect of my model. I am trying to fit a monomolecular equation to this data and I get the following error: gradient matrix must be of size 46 by 3
See bellow my code:
myfun <- function(a, b, c, avP) {
+ a-(a+b)*exp(-c*avP)}
> mono.fun <- deriv(body (myfun)[[2]],
+ namevec = c("avP", "a", "b", "c"),
+ function.arg=myfun)
> startsite <- c(a=0.19, b=0.04, c=1)
> nlmer(Pret ~ mono.fun(a,b,c,avP) ~ (a|study),
+ data=data, start=startsite, verbose = TRUE)
It seems to be a very simple case. I am learning how to work in R.
I really appreciate any help!
Thank you!
Raquel
More information about the R-sig-mixed-models
mailing list