From: Jens Hainmueller <jhainm_at_fas.harvard.edu>

Date: Sat 05 Aug 2006 - 03:26:49 EST

Weights <- rnorm(n)

# Includes Pos and Neg Weights

Weights

R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Sat Aug 05 03:30:11 2006

Date: Sat 05 Aug 2006 - 03:26:49 EST

Dear List,

Why do commonly used estimator functions (such as lm(), glm(), etc.) not allow negative case weights? I suspect that there is a good reason for this. Yet, I can see reasonable cases when one wants to use negative case weights.

Take lm() for example:

###

n <- 20 Y <- rnorm(n) X <- cbind(rep(1,n),runif(n),rnorm(n))

Weights <- rnorm(n)

# Includes Pos and Neg Weights

Weights

# Now do Weighted LS and get beta coeffs:

b <- solve(t(X)%*%diag(Weights)%*%X) %*% t(X) %*% diag(Weights)%*%Y
b

# This seems like a valid model, but when I try

lm(Y ~ X[,2:3],weights=Weights)

# I get: "missing or negative weights not allowed"

###

What is the rationale for not allowing negative weights? I ask this, because I am currently trying to implement a (two stage) estimator into R that involves negative case weights. Weights are generated in the first stage, so it would be nice if I could use canned functions such as lm(,weights=Weights) in the second stage.

Thank you for your help.

Best,

Jens

R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Sat Aug 05 03:30:11 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Sat 05 Aug 2006 - 06:18:02 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*