[R-sig-ME] nlmer function

Federico Calboli federico.calboli at helsinki.fi
Sun Jul 12 16:52:42 CEST 2015


> On 12 Jul 2015, at 17:48, Federico Calboli <federico.calboli at helsinki.fi> wrote:
> 
> 
>> On 8 Jul 2015, at 11:18, elham haem <elhamhaem at gmail.com> wrote:
>> 
>> Dear lme4 authors,
>> 
>> 
>> I have studied “Mixed models in R using the lme4 package Part 6: Nonlinear
>> mixed models” by Douglas Bates. In this tutorial, there are some codes to
>> fit nonlinear mixed models for Theoph data. The codes are as fallows:
>> 
>> 
>> 
>>> Th. start <- c(lKe = -2.5, lKa = 0.5 , lCl = -3)
>> 
>>> nm1 <- nlmer ( conc ~ SSfol (Dose , Time ,lKe , lKa , lCl) ~
>> 
>> +    0+ lKe+lKa+lCl +(0+ lKe| Subject )+(0+ lKa| Subject )
>> 
>> +    +(0+ lCl| Subject ), nAGQ =0, Theoph ,
>> 
>> +     start = Th.start , verbose = TRUE )
>> 
>> 
>> I have 2 problems:
>> 
>> 1. when I run these codes, I see this error:
>> 
>> Error: unexpected '=' in:
>> 
>> "+ +(0+ lCl| Subject ), nAGQ =0, Theoph ,
>> 
>> + start ="
>> 
>> 2. I want to add a covariate (like age) to CL parameter. How should I
>> modify above codes?
>> 
> 
> When you copy code verbatim from a pdf you copy the formatting, hence the code is unlikely to work.  This, which is lifted verbatim and fixed in a text editor by removing extra spaces in the formatting, and the line breaks, works.
> 
> library(lme4)
> data(Theph)

the most astute will notice the data is called ‘Theoph' not ‘Theph’ 


> Th.start <- c( lKe = -2.5 , lKa = 0.5 , lCl = -3)
> nm1 <- nlmer ( conc ~ SSfol ( Dose , Time , lKe , lKa , lCl ) ~ 0+ lKe + lKa + lCl +(0+ lKe | Subject )+(0+ lKa | Subject ) +(0+ lCl | Subject ), nAGQ =0 , Theoph , start = Th.start , verbose = TRUE )
> 
> 
> 
> 
>> 
>> Thanks in advance
>> 
>> Elham Haem
>> 
>> 	[[alternative HTML version deleted]]
>> 
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 
> 
> --
> Federico Calboli
> Ecological Genetics Research Unit
> Department of Biosciences
> PO Box 65 (Biocenter 3, Viikinkaari 1)
> FIN-00014 University of Helsinki
> Finland
> 
> federico.calboli at helsinki.fi
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


--
Federico Calboli
Ecological Genetics Research Unit
Department of Biosciences
PO Box 65 (Biocenter 3, Viikinkaari 1)
FIN-00014 University of Helsinki
Finland

federico.calboli at helsinki.fi



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