[R] how to merge the fitted values from a linear model?

kayj kjaja27 at yahoo.com
Wed Sep 2 00:32:39 CEST 2009


Hi All,

I would like to run a linear model where the response is the duration of
relief in days and the regressor is the drug dosage in mg. Then I would like
compute the predicted values of the duration of relief from the model and
merge it into the original data. I am not sure how the merge happens since
if I have missing values in the data, R runs the resgression model but
fitted values for some observations are not being calculated.

Below is my R script

Mydata<-read.csv(file=”file1.csv”, header=T)

Model<-lm(y ~ x, data=Mydata)
f<-fitted(Model)
Newdata<-cbind(f , Mydata)

Is Newdata merged correctly?

Thanks for your help
 

-- 
View this message in context: http://www.nabble.com/how-to-merge-the-fitted-values-from-a-linear-model--tp25248552p25248552.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list