[R] lme4: Error in getResponseFormula(form) : "Form" must be a two sided formula
Douglas Bates
bates at stat.wisc.edu
Sat Feb 11 17:37:19 CET 2006
On 2/10/06, Spencer Graves <spencer.graves at pdf.com> wrote:
> Hi, Doug and Chris:
>
> I just got the same error message with the "lmList" example in lme4:
>
> > (fm1 <- lmList(breaks ~ wool | tension, warpbreaks))
> Call:
> Error in getResponseFormula(form) : "Form" must be a two sided formula
> > sessionInfo()
> R version 2.2.1, 2005-12-20, i386-pc-mingw32
>
> attached base packages:
> [1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
> [7] "base"
>
> other attached packages:
> lme4 lattice Matrix
> "0.995-2" "0.12-11" "0.995-5"
Hmm. I am unable to reproduce that in either R-devel or R-patched under Linux
> library(lme4)
Loading required package: Matrix
Loading required package: lattice
> (fm1 <- lmList(breaks ~ wool | tension, warpbreaks))
Call: lmList(formula = breaks ~ wool | tension, data = warpbreaks)
Coefficients:
(Intercept) woolB
L 44.55556 -16.333333
M 24.00000 4.777778
H 24.55556 -5.777778
Degrees of freedom: 54 total; 48 residual
Residual standard error: 10.94028
> sessionInfo()
Version 2.3.0 Under development (unstable) (2006-02-11 r37328)
i686-pc-linux-gnu
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
other attached packages:
lme4 lattice Matrix
"0.995-2" "0.13-3" "0.995-5"
> library(lme4)
Loading required package: Matrix
Loading required package: lattice
> (fm1 <- lmList(breaks ~ wool | tension, warpbreaks))
Call: lmList(formula = breaks ~ wool | tension, data = warpbreaks)
Coefficients:
(Intercept) woolB
L 44.55556 -16.333333
M 24.00000 4.777778
H 24.55556 -5.777778
Degrees of freedom: 54 total; 48 residual
Residual standard error: 10.94028
> sessionInfo()
R version 2.2.1, 2005-12-20, i486-pc-linux-gnu
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
other attached packages:
lme4 lattice Matrix
"0.995-2" "0.12-3" "0.995-5"
>
> I quit then restarted R and tried the same example in nlme: It
> seemed to work fine.
>
> Chris, have you tried this in nlme? If you absolutely need some
> feature of lme4, at least you could do this kind of preliminary work in
> nlme, then switch to lme4 (after quitting and restarting R to avoid
> potential conflicts between nlme and lme4).
>
> hope this helps.
> spencer graves
>
> Douglas Bates wrote:
> > Please check which packages you have attached when you call lmList.
> > That error message looks as if it is coming from the version of lmList
> > that is in the nlme package, not the one in lme4.
> >
> > On 2/6/06, Chris Evans <stats at psyctc.org> wrote:
> >
> >>I'm sure I'm being stupid so flame away...
> >>
> >>R2.2.1 on Windoze (boohoo) latest updates of packages.
> >>
> >>I'm exploring a dataset (land) with three variables looking at an
> >>narrowly unbalanced two group (GROUP) ANCOVA of a randomised
> >>controlled trial analysing endpoint score (SFQ.LOCF.ENDPOINT) entering
> >>the baseline score (SFQ.BASELINE) as covariate and the following work
> >>fine:
> >>
> >>
> >>>res.same <- lm(SFQ.LOCF.ENDPOINT ~ SFQ.BASELINE + GROUP,land)
> >>>res.diff <- lm(SFQ.LOCF.ENDPOINT ~ SFQ.BASELINE + GROUP + SFQ.BASELINE*GROUP,land)
> >>>anova(res.same,res.diff)
> >>
> >>I try:
> >>
> >>
> >>>lmList(SFQ.LOCF.ENDPOINT ~ SFQ.BASELINE | GROUP, land)
> >>
> >>Call:
> >>Error in getResponseFormula(form) : "Form" must be a two sided formula
> >>
> >>I'm puzzled. That looks like a two sided formula very like the one in
> >>the help for lme4 (which had been loaded) and the data look OK:
> >>
> >>
> >>>table(land$SFQ.LOCF.ENDPOINT)
> >>
> >> 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23
> >> 1 1 2 4 8 5 16 9 7 14 18 7 16 9 6 8 4 6 2 3
> >>
> >>>table(land$SFQ.BASELINE)
> >>
> >> 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
> >> 1 1 3 3 4 11 7 7 10 12 9 16 14 9 8 7 8 6 1 1
> >>
> >>>table(land$GROUP)
> >>
> >> 1 2
> >>87 89
> >>
> >>Advice accepted gratefully and flames ruefully!
> >>
> >>Chris
> >>
> >>--
> >>Chris Evans <chris at psyctc.org>
> >>Consultant Psychiatrist in Psychotherapy, Rampton Hospital;
> >>Research Programmes Director, Nottinghamshire NHS Trust,
> >>Hon. Professor of Psychotherapy, Nottingham University,
> >>Hon. SL Institute of Psychiatry
> >>*** My views are my own and not representative of those institutions ***
> >>
> >>______________________________________________
> >>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
> >>
> >
> >
> > ______________________________________________
> > 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