Announcement

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

  • ttest result and asdoc table not agree.

    Hi all,

    I am getting problem with results in asdoc table, p-values in the Word file not agree with stata output. example:

    Code:
    clear all
    set more off
    
    sysuse auto
    
    *ssc install asdoc
    
    ttest price, by(foreign)
    
    
    Two-sample t test with equal variances
    ------------------------------------------------------------------------------
       Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
    ---------+--------------------------------------------------------------------
    Domestic |      52    6072.423    429.4911    3097.104    5210.184    6934.662
     Foreign |      22    6384.682    558.9942    2621.915     5222.19    7547.174
    ---------+--------------------------------------------------------------------
    combined |      74    6165.257    342.8719    2949.496    5481.914      6848.6
    ---------+--------------------------------------------------------------------
        diff |           -312.2587    754.4488               -1816.225    1191.708
    ------------------------------------------------------------------------------
        diff = mean(Domestic) - mean(Foreign)                         t =  -0.4139
    Ho: diff = 0                                     degrees of freedom =       72
    
        Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
     Pr(T < t) = 0.3401         Pr(|T| > |t|) = 0.6802          Pr(T > t) = 0.6599
    
    asdoc ttest price, by(foreign)
    Asdoc t-student table show 2 p-value =0, but not agree with any results:
    Click image for larger version

Name:	Sin título.png
Views:	1
Size:	6.4 KB
ID:	1542143

    Last edited by Rodrigo Badilla; 20 Mar 2020, 13:51.

  • #2
    I cannot replicate your problem on my computer. I am running a fully updated Stata 16.1, with the most recent version of -asdoc- (see output below). It looks like your screenshot is for a *one* sample t-test, in which case your p-values would be quite small since they are very far away from the default null hypothesis value of zero. You have however compute a *two* sample -ttest- just above that. Perhaps you have made a mistake in your code.

    Code:
    . which asdoc
    *! Version 2.3.4.1: Changes made June 15, 2019: option label added to list command; Fixing bys sum in MacOS
    
    (output omitted)
    
    . asdoc ttest price, by(foreign)
    
    Two-sample t test with equal variances
    ------------------------------------------------------------------------------
       Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
    ---------+--------------------------------------------------------------------
    Domestic |      52    6072.423    429.4911    3097.104    5210.184    6934.662
     Foreign |      22    6384.682    558.9942    2621.915     5222.19    7547.174
    ---------+--------------------------------------------------------------------
    combined |      74    6165.257    342.8719    2949.496    5481.914      6848.6
    ---------+--------------------------------------------------------------------
        diff |           -312.2587    754.4488               -1816.225    1191.708
    ------------------------------------------------------------------------------
        diff = mean(Domestic) - mean(Foreign)                         t =  -0.4139
    Ho: diff = 0                                     degrees of freedom =       72
    
        Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
     Pr(T < t) = 0.3401         Pr(|T| > |t|) = 0.6802          Pr(T > t) = 0.6599
    
                        Two-sample t test with equal variances
    
    ----------------------------------------------------------------------------------------------------------------
                           |      obs1       obs2      Mean1      Mean2        dif     St_Err    t_value    p_value
    -----------------------+----------------------------------------------------------------------------------------
    price by foreign       |                                                                                        
                       0 1 |        52         22   6072.423   6384.682  -312.2585    754.449        -.4        .68
    ----------------------------------------------------------------------------------------------------------------
    (note: file Myfile.doc not found)
    Click to Open File:  Myfile.doc

    Comment


    • #3
      Thanks Leonardo Guizzetti, I did check my asdoc version:

      Code:
       which asdoc
      c:\ado\plus\a\asdoc.ado
      *! Attaullah Shah; [email protected]
      *! Tenured Associate Professor at the Institute of Management Sciences, Peshawar, Pakistan.
      *!-------------------------------------------------------------------------------
      *! Version 2.3.7.2 : Changes made on March 19, 2020     : Fixed bug in xtpoisson for irr option
      *! Attaullah Shah : Formatted macro: flocal creates a local that is formated for decimal points
      *! ltc 1 : List to comma, by Attaullah Shah, May 5, 2018
      And I changed to your version:

      Code:
      which asdoc
      c:\ado\plus\a\asdoc.ado
      *! Version 2.3.4.1: Changes made June 15, 2019: option label added to list command; Fixing bys sum in MacOS
      My new output:
      Click image for larger version

Name:	Sin título.png
Views:	1
Size:	6.6 KB
ID:	1542155




      Thanks for you reply!
      Regards
      Rodrigo

      Comment

      Working...
      X