[R] Problem with effects package

John Fox jfox at mcmaster.ca
Wed Apr 11 13:39:00 CEST 2012


Dear Michael,

>From ?effect (under "Warnings and Limitations"):

"Binomial generalized linear models cannot have a matrix of successes and failures on the left-hand side of the model formula; instead specify the proportion of successes (i.e., successes/(successes + failures)) as the response, and give the number of binomial trials (i.e., successes + failures) in the weights argument to glm."

Best,
 John

------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
	

On Wed, 11 Apr 2012 07:20:51 -0400
 Michael Kubovy <kubovy at virginia.edu> wrote:
> > sessionInfo()
> R version 2.15.0 (2012-03-30)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
> 
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> 
> attached base packages:
> [1] grid      datasets  splines   utils     stats    
> [6] graphics  grDevices methods   base     
> 
> other attached packages:
>  [1] effects_2.1-0       colorspace_1.1-1   
>  [3] nnet_7.3-1          nlme_3.1-103       
>  [5] lattice_0.20-6      reshape_0.8.4      
>  [7] plyr_1.7.1          catdata_1.0        
>  [9] cacheSweave_0.6-1   stashR_0.3-5       
> [11] filehash_2.2-1      BiocInstaller_1.4.3
> [13] ctv_0.7-4           sos_1.3-1          
> [15] brew_1.0-6          Hmisc_3.9-3        
> [17] survival_2.36-12    MASS_7.3-17        
> 
> loaded via a namespace (and not attached):
> [1] cluster_1.14.2 digest_0.5.2   tools_2.15.0  
> 
> # copy and paste the following:
> library( catdata )
> data( unemployment )
> unempt <- unemployment
> unempt$durbin <- unempt$durbin - 1
> library( reshape )
> unempt <-  melt( table( unempt ) )
> unempw <- cast( unempt, age ~ durbin )
> names( unempw ) <- c( 'age', 'short', 'long' )
> modt <- glm( durbin ~ age, weights = value, family = binomial, data = unempt )
> modw <- glm( cbind( short, long ) ~ age, family = binomial, data = unempw )
> library( effects )
> modt.ef <- effect( 'age', modt ) # works!
> modw.ef <- effect( 'age', modw ) # doesn't work!
> # Error in eval(expr, envir, enclos) : object 'age' not found
> # end
> 
> ______________________________________________
> Professor Michael Kubovy
> University of Virginia
> Department of Psychology
> for mail add:						for FedEx or UPS add: 
> P.O.Box 400400					Gilmer Hall, Room 102
> Charlottesville, VA 22904-4400	485 McCormick Road
> USA							Charlottesville, VA 22903
> 		room	phone
> Office:    B011	+1-434-982-4729
> Lab:        B019	+1-434-982-4751
> WWW:    http://www.people.virginia.edu/~mk9y/
>



More information about the R-help mailing list