Francesca Pancotto
2009-Oct-22 10:56 UTC
[R] How to perform an ols estimation with lm ignoring NA values
Dear R community, probably my question is obvious but I did not find any solution yet by browsind the mailing list results. I need to perform a simple ols regression in a dataset with cross section data, where no temporal dimension is inserted. In this data set there are missing values. I would like the software to perform the ols regression but to just ignore these data and consider the rest. I tried to use the function na.action=na.omit in lm( y~x, na.action=na.omit) but it seems to exert no effect on the function. Thank you for any available help. Francesca -- Post - doc Finance HEC Management School of the University of Li?ge Rue Louvrex, 14 , Bldg N1 , B-4000 Li?ge Belgium Web: https://mail.sssup.it/~pancotto
David Winsemius
2009-Oct-22 12:30 UTC
[R] How to perform an ols estimation with lm ignoring NA values
On Oct 22, 2009, at 6:56 AM, Francesca Pancotto wrote:> > Dear R community, > probably my question is obvious but I did not find any solution yet by > browsind the mailing list results. > I need to perform a simple ols regression in a dataset with cross > section > data, where no temporal dimension is inserted. In this data set > there are > missing values. I would like the software to perform the ols > regression > but to just ignore these data and consider the rest. > > I tried to use the function na.action=na.omit in > > lm( y~x, na.action=na.omit) > but it seems to exert no effect on the function.You would not expect to see a change in behavior since that is the default na.action for the lm function: ?lm Some details about x and y would help in understanding why you think the output is not what should be expected. If you are not going to provide an example dataset with dput(x) and dput(y) then at the very least provide summary(x) and summary(y). -- David Winsemius, MD Heritage Laboratories West Hartford, CT