Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: FW: Imputation Commands ?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: FW: Imputation Commands ?
Date   Tue, 29 Apr 2008 17:30:18 +0100

Assuming that this is based on some real example, only you know what makes sense for such data. Otherwise put, there is some context that you would need to supply before better advice became easier. 

The row mean is just 

egen rowmean = rowmean(x1 x2 x3 x4 x5) 

after which you can impute by replacement: 

qui foreach v of var x1 x2 x3 x4 x5 { 
	replace `v' = rowmean if missing(`v') 
} 

For integers, the row median is another possibility: 

FAQ     . . . . . . . . . . . . . . . . . . . . . . .  Calculating row medians
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        3/07    How do I calculate row medians?
                http://www.stata.com/support/faqs/stat/medians.html

However, by most modern standards these are lousy imputation commands, partly because they take no account of relationships between the variables. Others will quite rightly recommend seeking out Patrick Royston's programs. 

Nick 
[email protected] 

Daniel Sepulveda-Adams

I'm having trouble finding the proper command to impute values in a given
row of data. Hoping someone could direct me appropriately.

Consider a row of data as follows

��������� obs x1� x2� x3� x4 x5
��������� --�� --� --� --� --� -- --
��������� 1��   2�� 4�� .��� 5�  1
��������� 2��   .�� 4�� 1��� 3�  0
��������� 3��  1��  .�� .�� � .�  1

What I want to do is to fill-in the missing values as a function of the
surrounding row/variable values. I presume I want to average a given
missing-value's surrounding +-3 values and impute accordingly.

What command or commands should I investigate?


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index