Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with 95% CI from mean command

    Hi all,

    Apologies if this has been discussed before, but I couldn't find anything on it.

    I'm using Stata 14.1, and having an issue with the command 'mean'. Specifically, the 95% confidence intervals it generates don't appear to be 95%. As an example, when I run mean on a variable in my dataset, it generates the following output:

    . mean day

    Mean estimation Number of obs = 212

    --------------------------------------------------------------
    | Mean Std. Err. [95% Conf. Interval]
    -------------+------------------------------------------------
    day | 1659.731 326.08 1016.939 2302.523
    --------------------------------------------------------------


    However, when I manually calculate the 95% confidence interval based on the formula:

    x̅ ± z(0.05/2) x S.E.

    I get a confidence interval of 1020.626 - 2298.836. Similar, but not exactly the same.

    Working backwards from the CI generated by stata, it looks like it's using a z that is smaller than 0.05 - and the exact value varies depending on the calculation/variable used.

    Not a major issue, I would just like to understand why it is doing it (assuming its deliberate).

  • #2
    I recommend that you check the formulae that are used. You assume "z", i.e. normal approximation, when in fact "t" is used:

    Code:
    . sysuse auto
    (1978 Automobile Data)
    
    . mean price
    
    Mean estimation                   Number of obs   =         74
    
    --------------------------------------------------------------
                 |       Mean   Std. Err.     [95% Conf. Interval]
    -------------+------------------------------------------------
           price |   6165.257   342.8719      5481.914      6848.6
    --------------------------------------------------------------
    
    . di 6165.257 + invnorm(.975)*342.8719
    6837.2736
    
    . di 6165.257 + invttail(73,.025)*342.8719
    6848.5997

    Comment

    Working...
    X