[R-sig-ME] trouble using the lmer function
Ken Beath
ken at kjbeath.com.au
Mon Aug 24 02:00:49 CEST 2009
The problem is in the calculation of the derivatives, this
grMod(donnees$DOSE,log(5),log(500),log(30),log(2))
will show that some are NaN. It probably means that underflow has resulted
in a 0/0 in the gradient formula.
Ken
On Sun, August 23, 2009 9:41 am, Julie Bertrand wrote:
> Dear All,
>
> I meet trouble using the lmer function on a data set simulated with a
> gamma Emax Model.
>
> I use the following code, where initial conditions are set to the true
> values :
> GammaEmaxmodel<-function(D,lE0,lE50,lEmax,lHill)exp(lE0)+exp(lEmax)*D^exp(lHill)/(exp(lE50)^exp(lHill)+D^exp(lHill))
> grMod <- deriv(body(GammaEmaxmodel), namevec =
> c("lE0","lE50","lEmax","lHill"), func = GammaEmaxmodel)
>
> fit.lme4<-nlmer(DV~grMod(DOSE,lE0,lE50,lEmax,lHill)~(lE0+lEmax+lE50)|ID,#
> donnees,
> start = c(lE0=log(5),lE50=log(500),lEmax=log(30),lHill=log(2))
> )
> and obtain the error message : "Erreur dans asMethod(object) : matrix is
> not symmetric [1,2]"
>
> I am on Windows XP, with R version 2.9.1 (2009-06-26) and
> lme4_0.999375-31.
>
> When I do not try to estimate the Hill parameter I obtain no error message
> :
> >
> GammaEmaxmodel<-function(D,lE0,lE50,lEmax)exp(lE0)+exp(lEmax)*D/(exp(lE50)+D)
> > grMod <- deriv(body(GammaEmaxmodel), namevec =
> c("lE0","lE50","lEmax"), func = GammaEmaxmodel)
> >
> >
> > fit.lme4<-nlmer(DV~grMod(DOSE,lE0,lE50,lEmax)~(lE0+lEmax+lE50)|ID,#
> + donnees,
> + start = c(lE0=log(5),lE50=log(500),lEmax=log(30))
> + )
> > fit.lme4
> Nonlinear mixed model fit by the Laplace approximation
> Formula: DV ~ grMod(DOSE, lE0, lE50, lEmax) ~ (lE0 + lEmax + lE50) | ID
> Data: donnees
> AIC BIC logLik deviance
> 2235 2273 -1107 2215
> Random effects:
> Groups Name Variance Std.Dev. Corr
> ID lE0 1.7172 1.3104
> lEmax 18.8214 4.3384 -0.171
> lE50 27.4499 5.2393 -0.128 0.954
> Residual 4.2807 2.0690
> Number of obs: 324, groups: ID, 81
>
> Fixed effects:
> Estimate Std. Error t value
> lE0 1.2769 0.1591 8.024
> lE50 7.9102 0.6817 11.603
> lEmax 4.6933 0.5867 7.999
>
> Correlation of Fixed Effects:
> lE0 lE50
> lE50 -0.058
> lEmax -0.098 0.962
>
> Further, I succeed in estimating the Hill parameter using the nlme
> function (nlme_3.1-93) :
>
> > fit.nlme2<-nlme(DV~GammaEmaxmodel(DOSE,lE0,lE50,lEmax,lHill),
> + data=dat,
> + fixed=lE0+lEmax+lE50+lHill~1,
> + random=lE0+lEmax+lE50~1,
> + start =
> c(lE0=log(5),lE50=log(500),lEmax=log(30),lHill=log(2)),
> + weights=NULL
> + )
> > fit.nlme2
> Nonlinear mixed-effects model fit by maximum likelihood
> Model: DV ~ GammaEmaxmodel(DOSE, lE0, lE50, lEmax, lHill)
> Data: dat
> Log-likelihood: -1007.409
> Fixed: lE0 + lEmax + lE50 + lHill ~ 1
> lE0 lEmax lE50 lHill
> 1.4964002 3.2601144 6.0436652 0.4885341
>
> Random effects:
> Formula: list(lE0 ~ 1, lEmax ~ 1, lE50 ~ 1)
> Level: ID
> Structure: General positive-definite, Log-Cholesky parametrization
> StdDev Corr
> lE0 7.642895e-02 lE0 lEmax
> lEmax 5.686393e-01 1.00
> lE50 3.690756e-05 0.01 0.01
> Residual 3.906402e+00
>
> Number of Observations: 324
> Number of Groups: 81
>
> The data are simulated with Hill=2, please find enclose the data set
> that leads to these outputs (simdat.txt).
> I also simulated a correlation between the lEmax and lE50 parameters
> however I coul not figure out how to code such a random effects matrix
> in lmer.
>
> The first error message is due to lmer trouble in estimating the Hill
> parameter on this data set, or must I change something in my code or
> data set ?
>
> Thank you in advance.
>
> Julie Bertrand
>
> --
> UMR 738, INSERM, Université Paris Diderot
>
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list