[R] Error message from allEffects(model) / effect(model)" ‘range’ not meaningful for factors"

John Fox jfox at mcmaster.ca
Wed Aug 19 17:55:10 CEST 2015


Hi,

> m <- lm(y~x) # no problem

> allEffects(m)# also no problem
 model: y ~ x

 x effect
x
       a        b        c 
3.322448 3.830997 4.969154

> effect("x", m) # ditto

 x effect
x
       a        b        c 
3.322448 3.830997 4.969154 

> Effect("x", m) # ditto

 x effect
x
       a        b        c 
3.322448 3.830997 4.969154

Best,
 John

-----------------------------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.socsci.mcmaster.ca/jfox/




> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Robert
> Zimbardo
> Sent: Tuesday, August 18, 2015 8:50 PM
> To: r-help at r-project.org
> Subject: [R] Error message from allEffects(model) / effect(model)"
> ‘range’ not meaningful for factors"
> 
> Hi
> 
> I cannot figure out why the effects package throws me error messages
> with the following simple code:
> 
> 
> rm(list=ls(all=TRUE)); set.seed(1); library(effects)
> # set up data
> x <- factor(rep(letters[1:3], each=100))
> y <- c(rnorm(100, 3, 3), rnorm(100, 4, 3), rnorm(100, 5, 3))
> 
> 
> # fit linear model
> m <- summary(lm(y~x)) # no problem
> 
> # now the problem
> plot(allEffects(m))
> # Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> :
> #   ‘range’ not meaningful for factors
> plot(effect("x", m))
> # Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> :
> #   ‘range’ not meaningful for factors
> 
> 
> Any ideas? It's go to be something superobvious, but I don't get it.
> Thanks,
> RZ
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list