Chris Evans
2006-Feb-06 22:29 UTC
[R] lme4: Error in getResponseFormula(form) : "Form" must be a two sided formula
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 ***
Douglas Bates
2006-Feb-06 23:39 UTC
[R] lme4: Error in getResponseFormula(form) : "Form" must be a two sided formula
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 >
You could substitute lines(kernelgraf) for your last line: points(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1), col=rgb(0,0,1), main="") See ?lines Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of statistical.model at googlemail.com Sent: Saturday, February 11, 2006 1:44 PM To: r-help at stat.math.ethz.ch Subject: [R] plots Hi all, I have a basic question. how can i visualize two or more density curves on the same plot? ex: x1<-runif(100,10,80) x2<-runif(100,1,100) kernelgraf<-density(x1,kernel = "gaussian", width= 20) plot(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1), col=rgb(0,1,0), main="") kernelgraf<-density(x2,kernel = "gaussian", width= 20) points(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1), col=rgb(0,0,1), main="") here i am using plot + points, but i do not like the graphical output for points. can anybody help me? thanks in advance Roberto Furlan University of Turin ---------------------------------------- La mia Cartella di Posta in Arrivo e protetta da SPAMfighter 204 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter!
Le 11.02.2006 19:44, statistical.model at googlemail.com a ??crit :> Hi all, > I have a basic question. how can i visualize two or more density curves on > the same plot? > > ex: > x1<-runif(100,10,80) > x2<-runif(100,1,100) > kernelgraf<-density(x1,kernel = "gaussian", width= 20) > plot(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1), > col=rgb(0,1,0), main="") > kernelgraf<-density(x2,kernel = "gaussian", width= 20) > points(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1), > col=rgb(0,0,1), main="") > > here i am using plot + points, but i do not like the graphical output for > points. >You are almost there, replace your last command by : points(kernelgraf, type="l", col="blue") Romain PS : Maybe a function points.density setting type="l" would be a good thing ?> can anybody help me? > > thanks in advance > > Roberto Furlan > University of Turin >-- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php +---------------------------------------------------------------+ | Romain FRANCOIS - http://francoisromain.free.fr | | Doctorant INRIA Futurs / EDF | +---------------------------------------------------------------+
Romain Francois wrote:> Le 11.02.2006 19:44, statistical.model at googlemail.com a ??crit : > >>Hi all, >>I have a basic question. how can i visualize two or more density curves on >>the same plot? >> >>ex: >>x1<-runif(100,10,80) >>x2<-runif(100,1,100) >>kernelgraf<-density(x1,kernel = "gaussian", width= 20) >>plot(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1), >>col=rgb(0,1,0), main="") >>kernelgraf<-density(x2,kernel = "gaussian", width= 20) >>points(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1), >>col=rgb(0,0,1), main="") >> >>here i am using plot + points, but i do not like the graphical output for >>points. >> > > You are almost there, replace your last command by : > > points(kernelgraf, type="l", col="blue") > > Romain > > PS : Maybe a function points.density setting type="l" would be a good > thing ?Or maybe use lines(kernelgraf, type="l", col="blue") As I always say, when you want lines, use lines(). Duncan Murdoch> >>can anybody help me? >> >>thanks in advance >> >>Roberto Furlan >>University of Turin >> > >
Le 11.02.2006 19:59, Duncan Murdoch a ??crit :> Romain Francois wrote: >> Le 11.02.2006 19:44, statistical.model at googlemail.com a ??crit : >> >>> Hi all, >>> I have a basic question. how can i visualize two or more density >>> curves on >>> the same plot? >>> >>> ex: >>> x1<-runif(100,10,80) >>> x2<-runif(100,1,100) >>> kernelgraf<-density(x1,kernel = "gaussian", width= 20) >>> plot(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1), >>> col=rgb(0,1,0), main="") >>> kernelgraf<-density(x2,kernel = "gaussian", width= 20) >>> points(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1), >>> col=rgb(0,0,1), main="") >>> >>> here i am using plot + points, but i do not like the graphical >>> output for >>> points. >>> >> >> You are almost there, replace your last command by : >> >> points(kernelgraf, type="l", col="blue") >> >> Romain >> >> PS : Maybe a function points.density setting type="l" would be a good >> thing ? > > Or maybe use > > lines(kernelgraf, type="l", col="blue") > > As I always say, when you want lines, use lines(). > > Duncan MurdochYou are right Duncan, I wish there was a coffea() function in R ;-) -- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php +---------------------------------------------------------------+ | Romain FRANCOIS - http://francoisromain.free.fr | | Doctorant INRIA Futurs / EDF | +---------------------------------------------------------------+