[R] Weighting data when running regressions

From: Elena Wilson <wilson_family_at_optusnet.com.au>
Date: Mon, 10 Mar 2008 22:49:15 +1100


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    

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. Received on Mon 10 Mar 2008 - 12:17:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 10 Mar 2008 - 13:30:20 GMT.

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

list of date sections of archive