Statalist


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

st: -impute- variable creates only type 'float'


From   Hewan Belay <[email protected]>
To   Stata List <[email protected]>
Subject   st: -impute- variable creates only type 'float'
Date   Mon, 14 Jul 2008 15:28:47 -0700 (PDT)

Dear Statalist,

In the course of working my way through another dialogue (on xtoverid, with Mark Schaffer) this data management question arose that I couldn't crack and didn't find a previous statalist discussion on:

It appears that the command to estimate missing values, -impute-, always generates the new predicted value as a 'float' type. -impute- doesn't seem to have an option for setting the type. Even when I set the type to double permanently, -impute- still creates 'float' variables. It's a problem because I want to do some comparisons between the original variable and the imputed variable, and I found that differences are not only due to the missing values, but also because, as type float, the newly estimated variable has different values for large numbers due to 'float's imprecision. 

Here's an example using data on the web that shows that -impute- creates variables only as 'floats', which won't be overriden by above mentioned action:

.. webuse abdata, clear

.. set type double, permanently
(set type preference recorded)

.. gen here_it_works = 5

.. egen here_too = rowtotal(n w)

.. impute   nL2 w k, gen(but_not_here)
 27.16% (280) observations imputed

.. describe  here_it_works here_too but_not_here

              storage  display     value
variable name   type   format      label      variable label
--------------------------------------------------------------
here_it_works   double %10.0g                 
here_too        double %10.0g                 
but_not_here    float  %9.0g                  imputed nL2

How can I generate a 'double' type variable instead with -impute- ?

Thank you,
Hewan


      

*
*   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