[R] nlme model specification
Spencer Graves
spencer.graves at pdf.com
Sat May 20 17:39:05 CEST 2006
Thanks for providing such a simple, replicatable example. When I
tried that and similar examples, the response matched what you report.
I also tried the following slight modification of the 'nlme' call that
worked for you:
> mod4 <-
+ nlme(circumference ~ SSlogis(age, Asym, xmid, scal),
+ data = Orange,
+ fixed = list(Asym+xmid+scal ~ 1),
+ start = fixef(fm1Oran.lis))
Error in parse(file, n, text, prompt) : syntax error in "~ "
This error message matches what you got. I tentatively conclude that
'fixed' does NOT like an argument of class 'list'. To diagnose this
further, I tried 'traceback':
> traceback()
6: parse(text = paste("~", paste(nVal, collapse = "/")))
5: eval(parse(text = paste("~", paste(nVal, collapse = "/"))))
4: getGroupsFormula.reStruct(reSt)
3: getGroupsFormula(reSt)
2: nlme.formula(circumference ~ SSlogis(age, Asym, xmid, scal),
data = Orange, fixed = list(Asym + xmid + scal ~ 1), start =
fixef(fm1Oran.lis))
1: nlme(circumference ~ SSlogis(age, Asym, xmid, scal), data = Orange,
fixed = list(Asym + xmid + scal ~ 1), start = fixef(fm1Oran.lis))
I then tried to further isolate the problem using 'debug':
> debug(getGroupsFormula.reStruct)
Error: object "getGroupsFormula.reStruct" not found
Unfortunately, it's hidden is a namespace:
> methods("getGroupsFormula")
[1] getGroupsFormula.default* getGroupsFormula.gls*
[3] getGroupsFormula.lme* getGroupsFormula.lmList*
[5] getGroupsFormula.reStruct*
Non-visible functions are asterisked
I could trace this further by making local copies of all the
functions in the call stack, but I don't have time for that right now.
'help(package="nlme")' says the 'author' is Pinheiro, Bates, DebRoy, and
Sarkar, and the 'Maintainer' is 'R-core'. I've cc-ed Bates on this
reply. If you don't hear from someone else in a few days, you might
consider making local copies of the functions in this call stack, then
trying 'debug(getGroupsFormula.reStruct)', and generating another post
based on what you learn doing that. You might see, for example, if the
example that works also calls 'getGroupFormula.reStruct'.
I'm sorry I couldn't provide an answer, but with luck, my reply will
inspire someone else to do something that can enlighten us both.
Best Wishes,
Spencer Graves
p.s. Before you submit another post on this, I suggest you
'update.packages'. A new version of 'nlme' is now available. It won't
solve your problem, but it at least will assure someone else that you
are up to date.
> sessionInfo()
Version 2.3.0 (2006-04-24)
i386-pc-mingw32
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
other attached packages:
nlme
"3.1-72"
Martin Henry H. Stevens wrote:
> Hi folks,
> I am tearing my hair out on this one.
> I am using an example from Pinheiro and Bates.
>
> ### this works
> data(Orange)
> mod.lis <- nlsList(circumference ~ SSlogis(age, Asymp, xmid, scal),
> data=Orange )
>
> ### This works
> mod <- nlme(circumference ~ SSlogis(age, Asymp, xmid, scal),
> data=Orange,
> fixed = Asymp + xmid + scal ~ 1,
> start = fixef(mod.lis) )
>
> ### I try a slightly different model specification for the fixed
> effects, and it does not work.
> ### fixed = list(Asymp ~ 1, xmid ~ 1, scal ~ 1)
> ### I tried following the example on page 355.
>
> mod <- nlme(circumference ~ SSlogis(age, Asymp, xmid, scal),
> data=Orange,
> fixed = list(Asymp ~ 1, xmid ~ 1, scal ~ 1),
> start = fixef(mod.lis) )
> ### I get
> Error in parse(file, n, text, prompt) : syntax error in "~ "
>
>
> nlme version 3.1-71
>
> > version
> _
> platform powerpc-apple-darwin8.6.0
> arch powerpc
> os darwin8.6.0
> system powerpc, darwin8.6.0
> status
> major 2
> minor 3.0
> year 2006
> month 04
> day 24
> svn rev 37909
> language R
> version.string Version 2.3.0 (2006-04-24)
> >
>
> Dr. M. Hank H. Stevens, Assistant Professor
> 338 Pearson Hall
> Botany Department
> Miami University
> Oxford, OH 45056
>
> Office: (513) 529-4206
> Lab: (513) 529-4262
> FAX: (513) 529-4243
> http://www.cas.muohio.edu/~stevenmh/
> http://www.muohio.edu/ecology/
> http://www.muohio.edu/botany/
> "E Pluribus Unum"
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list