Weighting data when running regressions
It works!!! Thanks a lot Chuck! -----Original Message----- From: Chuck Cleland [mailto:ccleland at optonline.net] Sent: Monday, 10 March 2008 11:29 PM To: Elena Wilson Cc: r-help at r-project.org Subject: Re: [R] Weighting data when running regressions
On 3/10/2008 7:49 AM, Elena Wilson wrote:
Dear R-Help, I'm new to R and struggling with weighting data when I run regression.
I've
tried to use search to solve my problem but haven't found anything helpful
so far.
I (successfully) import data from SPSS (15) and try to run a linear
regression on a subset of my data file where WEIGHT is the name of my
weighting variable (numeric), e.g.:
library(foreign)
data1=read.spss("File.sav", use.value.labels = FALSE, to.data.frame =
TRUE)
summary(data1) ' shows me all the variables OK attach(data1) linmod=lm(Y~X1+X2+X3+X4W, subset=(X5==1 & X6==7), weights==WEIGHT) and I get the following Error message: Error in weights == WEIGHT : comparison (1) is possible only for atomic and list types It works perfectly if I don't use the ", weights==WEIGHT" bit
Try it with just one equals sign after weights: linmod=lm(Y~X1+X2+X3+X4W, subset=(X5==1 & X6==7), weights=WEIGHT)
Could you please let me know what I am doing wrong? Thank you in advance, Lena [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org 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.
Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894