Re: R-alpha: weights in glm

Ross Ihaka (ihaka@stat.auckland.ac.nz)
Wed, 18 Dec 1996 14:00:40 +1300 (NZDT)


From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Date: Wed, 18 Dec 1996 14:00:40 +1300 (NZDT)
Message-Id: <199612180100.OAA09836@stat2.stat.auckland.ac.nz>
To: Thomas Lumley <thomas@biostat.washington.edu>
Subject: Re: R-alpha: weights in glm
In-Reply-To: <Pine.SUN.3.91.961217075740.9970A-100000@chekov>
	<Pine.SUN.3.91.961217075740.9970A-100000@chekov>

Thomas Lumley writes:
 > On Tue, 17 Dec 1996, Jim Lindsey wrote:
 > 
 > > 1. When I try to use weights in glm, I get the message
 > > Error in numeric(nr): negative length vectors are not allowed.
 > > I have not been able to trace this down.
 > 
 > It seems to work for me, though I have to specify na.action.
 > [There is a problem with na.action, resulting from an incompatible 
 > improvement in the handling of options since 0.12.  In the past, 
 > options("na.action") returned a one-element list; it now returns the 
 > element. The fix to this is to change the default na.action in 
 > model.frame. A patch for this is at the end of this message. ]

This appears to be fixed in the version 0.15 which I am testing at
present and which will be appearing on the net momentarity.  I have
unfixed the gratuitous change to options that Thomas mentions and this
may have fixed the problem.
	Ross

- - - e x a m p l e - - - s c r i p t - - -

R : Copyright 1996, Robert Gentleman and Ross Ihaka
Version 0.15  (Released: December 25, 1996)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type "license()" for details.

> x <- rnorm(50)
> y <- rnorm(50)
> w <- runif(50)
> a <- data.frame(x=x,y=y,w=w)
> rm(x,y,w)
> glm(y~x,data=a)

Call:  glm(y ~ x, data = a) 

Coefficients:
(Intercept)            x  
     0.0887      -0.2181  

Degrees of Freedom: 50 Total; 48 Residual
Null Deviance: 49.45 
Residual Deviance: 47.37 
> glm(y~x,data=a,weight=w)

Call:  glm(y ~ x, data = a, weight = w) 

Coefficients:
(Intercept)            x  
    -0.0177      -0.2345  

Degrees of Freedom: 50 Total; 48 Residual
Null Deviance: 24.03 
Residual Deviance: 22.83 
> glm(y~x,data=a,na.action=na.omit,weight=w)

Call:  glm(y ~ x, data = a, na.action = na.omit, weight = w) 

Coefficients:
(Intercept)            x  
    -0.0177      -0.2345  

Degrees of Freedom: 50 Total; 48 Residual
Null Deviance: 24.03 
Residual Deviance: 22.83 
> 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-