Dear all I have data (x,y) with data x is missing in 5 record of 100 record. I want to impute data x by use regression. How I can do this. THX Jumlong -- Jumlong Vongprasert Assist. Prof. Institute of Research and Development Ubon Ratchathani Rajabhat University Ubon Ratchathani THAILAND 34000
I assume you mean regression of x on y... here's the code: missing = is.na(x) predicted = predict(lm(x~y)) x[missing] = predicted[missing]; Should work but please check. Peter On Thu, Oct 14, 2010 at 10:14 PM, Jumlong Vongprasert <jumlong.ubru at gmail.com> wrote:> ?Dear all > I have data (x,y) with data x is missing in 5 record of 100 record. > I want to impute data x by use regression. > How I can do this. > THX > Jumlong