# [R-sig-ME] Can we fit this model in nlme or lme4? Monday, March 28, 2011 8:10 PM

Haoda Fu fuhds at yahoo.com.cn
Fri Apr 1 02:24:44 CEST 2011

```Ben and others -

Currently, I am using the following WinBUGS code to fit the model.
The estimation is good, but it took too much time to do some simulation.
So I was wondering if there is a way to do this fast since I only need the MLE estimate.

model
{
for (i in 1:nSUB) {
s[i] ~ dnorm(0, tau.precision);
}

for(j in 1 : nOBS) {
p[j] <- (E0 + Emax*Dose[j]/(ED50+Dose[j])+s[sub_seq[j]]) * (1-exp(k*X[j])) / (1-exp(k*d));
Y[j] ~ dnorm(p[j], sigma.precisionind[j]);
sigma.precisionind[j] <- sigma.precision / pow((1-exp(k*X[j])) / (1-exp(k*d)), 2);}

E0 ~ dnorm(0,0.0000001);
Emax ~ dnorm(40,0.00000001);
k~ dunif(-10,-0.001);
ED50 ~ dunif(0.0001,10000);
sigma.precision ~ dgamma(0.000001,0.000001) ;
tau.precision ~ dgamma(0.000001,0.000001) ;
Sigma<-sqrt(1/sigma.precision);
Tau<-sqrt(1/tau.precision);
}

Best,
Haoda
--- On Thu, 3/31/11, Ben Bolker <bbolker at gmail.com> wrote:

> From: Ben Bolker <bbolker at gmail.com>
> Subject: Re: [R-sig-ME] Can we fit this model in nlme or lme4? Monday, March 28,	2011 8:10 PM
> To: r-sig-mixed-models at r-project.org
> Date: Thursday, March 31, 2011, 7:22 AM
> Haoda Fu <fuhds at ...> writes:
>
> >
> > Hi,
> >
> > I was wondering if the following model can be fitted
> by nlme/lme4.
> > The difficult part is that the error term
> > is combined with other parameters.
> > The model that we need to fit is as below and the R
> codes
> > to generate data is provided as well. Many thanks!!!
> >
> > # Y_{ijk} = (E_0 + Emax*dose_i/(ED_50+dose_i) +
> >  S_{ij} +
> e_{ijk})*(1-exp(k*X_{ijk}))/(1-exp(k*d));
> > ## Parameters to be estimated E0, Emax, ED50, sigma_S,
> sigma_e, kn
> >
>
>   Thank you for the clear example.
>
>   But no, I don't see any way to do this in nlme/lme4
> (or in any other R mixed modeling package).
>   WinBUGS, AD Model Builder ...
>
>   Happy as always to be corrected by someone more
> knowledgeable.
>
>   Ben Bolker
>
> _______________________________________________
> R-sig-mixed-models at r-project.org
> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

```