# [R] Can we fit this model in nlme or lme4?

From: Haoda Fu <fuhds_at_yahoo.com.cn>
Date: Tue, 29 Mar 2011 09:10:12 +0800 (CST)

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

Patients <- 100; # 100 patients
nVisit <- 12; # total 12 visit
d <- 6; # 6 month study
dose <- c(0,5,10,20,40,100,200);
visits <- seq(6/12,6,by = 6/12);
# true parameters

E0 <- 2;
Emax <- 20;
ED50 <- 10;
sigma_S <- 5;
sigma_e <- 4;
k <- -1;

dataM <- matrix(NA, nrow = nPatients*nVisit, ncol= 4); for(iter in 1:nPatients){
dose_i <- sample(dose,1);
S_i <- rep(rnorm(n=1, mean=0, sd=sigma_S),nVisit); # random effect for this patients   e_i <- rnorm(n=nVisit, mean=0, sd=sigma_e);   response_i <- (E0+Emax*dose_i/(ED50+dose_i)+S_i+e_i)*(1-exp(k*visits))/(1-exp(k*d));   patients_i <- cbind(rep(iter,nVisit),rep(dose_i,nVisit),visits,response_i);   dataM[(nVisit*(iter-1)+1):(nVisit*(iter-1)+nVisit),] <- patients_i;   }

colnames(dataM) <- c("PatientID","Dose","VisitTime","Response")

Best,
Haoda

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 Mar 2011 - 01:13:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Mar 2011 - 01:50:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.