[R] missing data imputation

From: Anders Schwartz Corr <corr_at_fas.harvard.edu>
Date: Sat 09 Jul 2005 - 03:52:00 EST

Dear R-help,

I am trying to impute missing data for the first time using R. The norm package seems to work for me, but the missing values that it returns seem odd at times -- for example it returns negative values for a variable that should only be positive. Does this matter in data analysis, and/or is there a way to limit the imputed values to be within the minimum and maximum of the actual data? Below is the code I am using.

Thanks,

Anders Corr
Ph.D. Candidate

#DOWNLOAD DATA (61Kb)

download.file("
http://www.people.fas.harvard.edu/~corr/tc.csv","C:/R")

#RUN NORM

tc <- read.csv("tc.csv", header = TRUE)
rngseed(1234567) #set random number generator seed s <- prelim.norm(tc)
thetahat <- em.norm(s) #find the MLE for a starting value theta <- da.norm(s,thetahat,steps=20,showits=TRUE,return.ymis=TRUE) #take 20 steps ximp <- imp.norm(s,thetahat,tc) #impute missing data under the MLE



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 09 03:57:02 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:26 EST