i have a data matrix with some x variables complete and some y variables incomplete. i want to use the simplest regression imputation to fill in the missing data. (form a regression line with all complete cases and predict the missing values). is there any package that can do so? if not how should i write the code? -- View this message in context: http://r.789695.n4.nabble.com/regression-imputation-in-R-tp4675667.html Sent from the R help mailing list archive at Nabble.com.
Hi! For example if "data" is the complete dataset with both x and y values: tempdata = data[complete.cases(data[,1:2]),] # Regression data model = lm(y~x, data = tempdata) # Linear model>From this you can calculate the regression value of the missing values.Hope this helped! Regards, Chris -- View this message in context: http://r.789695.n4.nabble.com/regression-imputation-in-R-tp4675667p4675677.html Sent from the R help mailing list archive at Nabble.com.