[R-sig-ME] Covariables in nlmer

Dieter Menne dieter.menne at menne-biomed.de
Thu Mar 12 11:39:21 CET 2009


I am struggling with covariables in nlmer; I tried to get something 
that worked well in nlme in nlmer, and was stuck.

The last I noted was 

<http://www.nabble.com/Re:-covariates-in-nlmer-function-p12754515.html>

so I waited a few months after for the dust to settle.

Below my examples: one includes the variable <treat>, the other
leaves it out. Both functions converge, but the results are 
EXACTLY the same, as if the variable treat was simply not parsed at all.
Even if this is a misunderstanding of my side how to specify covariables, 
an error message would be more welcome than a black hole.

Dieter

----------------------------
R version 2.8.1 (2008-12-22) 
i386-pc-mingw32 

locale:
LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;

LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] lme4_0.999375-28   Matrix_0.999375-21 lattice_0.17-20   

loaded via a namespace (and not attached):
[1] grid_2.8.1  tools_2.8.1
--------------------------


# gastemptnlmer.r
library(lme4)

ge = read.table("http://www.menne-biomed.de/gastempt/gastempt5.csv", 
  header=TRUE)
ge$subj = as.factor(ge$subj)

EmptInit= function(mCall,LHS,data){ # dummy, not explicitely used
  stop("Should not be called")
}

# Standard LinExp model for gastric emptying
SSEmptLinExp=selfStart(~v0*(1+kappa*t/tempt)*exp(-t/tempt),
  initial=EmptInit, parameters= c("v0","kappa","tempt"))


start = list(fixef=c(v0=534,kappa=1,tempt=60))
ge0.nlmer = nlmer(
    v~SSEmptLinExp(t,v0,kappa,tempt)~ treat+(v0+kappa+tempt|subj),
    data=ge,  start=start)
summary(ge0.nlmer)

ge1.nlmer = nlmer(
    v~SSEmptLinExp(t,v0,kappa,tempt)~ (v0+kappa+tempt|subj),
    data=ge,  start=start)
summary(ge1.nlmer)




More information about the R-sig-mixed-models mailing list