Announcement

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

  • Increasing Number of Decimal Places for Output of Various Statistical Tests

    I apologize for the basic question.

    I understand how to change the format of data itself to manipulate the number of decimal places displayed. However, I've been unable to change the format of the measure of association or p-value reported for various statistical tests. Specifically, I'm interested in reporting an exact p value (either represented by say 8 decimal places, or by using an exponent) for the Chi Square or T-Test.

    Any advice is appreciated. Thank you in advance.

  • #2
    if you just want these results, you can find them in the return li; e.g.,
    Code:
    . sysuse auto
    (1978 Automobile Data)
    r; t=0.07 16:35:28
    
    . ta foreign rep78, chi
    
               |                   Repair Record 1978
      Car type |         1          2          3          4          5 |     Total
    -----------+-------------------------------------------------------+----------
      Domestic |         2          8         27          9          2 |        48
       Foreign |         0          0          3          9          9 |        21
    -----------+-------------------------------------------------------+----------
         Total |         2          8         30         18         11 |        69
    
              Pearson chi2(4) =  27.2640   Pr = 0.000
    r; t=0.04 16:35:38
    
    . return li
    
    scalars:
                      r(N) =  69
                      r(r) =  2
                      r(c) =  5
                   r(chi2) =  27.26396103896104
                      r(p) =  .0000175796084266
    r; t=0.05 16:35:42
    
    . ttest gear, by(foreign)
    
    Two-sample t test with equal variances
    ------------------------------------------------------------------------------
       Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
    ---------+--------------------------------------------------------------------
    Domestic |      52    2.806538    .0465887    .3359556    2.713008    2.900069
     Foreign |      22    3.507273    .0633009    .2969076    3.375631    3.638914
    ---------+--------------------------------------------------------------------
    combined |      74    3.014865    .0530423    .4562871    2.909152    3.120578
    ---------+--------------------------------------------------------------------
        diff |           -.7007343    .0826714               -.8655366   -.5359319
    ------------------------------------------------------------------------------
        diff = mean(Domestic) - mean(Foreign)                         t =  -8.4761
    Ho: diff = 0                                     degrees of freedom =       72
    
        Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
     Pr(T < t) = 0.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 1.0000
    r; t=0.11 16:35:51
    
    . return li
    
    scalars:
                  r(level) =  95
                     r(sd) =  .4562870967076302
                   r(sd_2) =  .2969075976199233
                   r(sd_1) =  .3359556497019149
                     r(se) =  .0826713610122472
                    r(p_u) =  .9999999999990102
                    r(p_l) =  9.89791773665e-13
                      r(p) =  1.97958354733e-12
                      r(t) =  -8.476142699637874
                   r(df_t) =  72
                   r(mu_2) =  3.507272720336914
                    r(N_2) =  22
                   r(mu_1) =  2.806538467223828
                    r(N_1) =  52
    if you do really want to change the out, see "h set cformat"

    Comment


    • #3
      Note that none of these values may be the "exact" value. See a discussion of precision in Stata: http://blog.stata.com/tag/precision/
      Stata/MP 14.1 (64-bit x86-64)
      Revision 19 May 2016
      Win 8.1

      Comment

      Working...
      X