Statalist The Stata Listserver


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

Re: st: A quick question


From   Robert A Yaffee <bob.yaffee@nyu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: A quick question
Date   Fri, 12 May 2006 03:52:29 -0400

Phil,
  Stata will assign a high value to a variable with a missing value.
You should decide whether you will use some form of imputation to
replace the missing value (mean, mean + random error, median, or none).

After possible replacement of some missing values,
you might issue a modified command:

generate BMI = weight1998/(height1998^2) if weight1998 < .

Regards,
   RAY

Robert A. Yaffee, Ph.D.
Research Professor
Shirley M. Ehrenkranz
School of Social Work
New York University

home address:
Apt 19-W
2100 Linwood Ave.
Fort Lee, NJ
07024-3171
Phone: 201-242-3824
Fax: 201-242-3825
yaffee@nyu.edu

----- Original Message -----
From: Phil Schumm <pschumm@uchicago.edu>
Date: Thursday, May 11, 2006 8:40 pm
Subject: Re: st: A quick question

> On May 11, 2006, at 5:34 PM, Albert Newton wrote:
> > I have two varibles: weight and height of respondents in 1989.
> >
> > weight1998      float  %9.0g
> > height1998      float  %9.0g
> >
> > I want to create a new variable:
> >
> > gen BMI = weight1998/(height1998^2)
> >
> > My little problem is that:  BMI takes strange values if 
> weight1998  
> > is missing.  Could anyone tell me why?  Thanks a lot!
> >
> > height1998	weight1998	BMI1989
> > 1.5748                  290                        53.04115
> > 1.4732                  256                        53.50351
> > 1.5494                  285                        53.84973
> > 1.5494                  306                        57.8176
> > 1.6764                  375                        60.52597
> > 1.905                   .                          124.4902
> > 1.778                   .                          142.9097
> > 1.778                   .                          142.9097
> > 1.6764                  .                          160.757
> > 1.6764                  .                          160.757
> > 1.6764                  .                          160.757
> 
> 
> It is clear that the variable you are listing (BMI1989) was not  
> calculated using the expression above.  For example, if we take the 
> 
> first observation:
> 
> 
> . di 290/(1.5748^2)
> 116.93572
> 
> 
> which is not equal to 53.04115.  We can help you a lot better if 
> you  
> include part of the actual log.  For example:
> 
> 
> . des
> 
> Contains data
>   obs:            11
> vars:             2
> size:           110 (99.9% of memory free)
> --------------------------------------------------------------------
> ---- 
> -------
>               storage  display     value
> variable name   type   format      label      variable label
> --------------------------------------------------------------------
> ---- 
> -------
> weight1998      int    %8.0g
> height1998      float  %9.0g
> --------------------------------------------------------------------
> ---- 
> -------
> Sorted by:
>      Note:  dataset has changed since last saved
> 
> . gen BMI = weight1998/(height1998^2)
> (6 missing values generated)
> 
> . li
> 
>      +--------------------------------+
>      | wei~1998   hei~1998        BMI |
>      |--------------------------------|
>   1. |      290     1.5748   116.9357 |
>   2. |      256     1.4732   117.9551 |
>   3. |      285     1.5494   118.7183 |
>   4. |      306     1.5494    127.466 |
>   5. |      375     1.6764   133.4369 |
>      |--------------------------------|
>   6. |        .      1.905          . |
>   7. |        .      1.778          . |
>   8. |        .      1.778          . |
>   9. |        .     1.6764          . |
>  10. |        .     1.6764          . |
>      |--------------------------------|
>  11. |        .     1.6764          . |
>      +--------------------------------+
> 
> 
> BTW, BMI is typically calculated as:
> 
> BMI = weight (kg) / height (m^2)
> 
> Your heights look about right (for meters), but your weights are 
> off  
> by about a factor of 4.
> 
> 
> -- Phil
> 
> *
> *   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/
> 
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index