asdocx: Export from Stata to Word, Excel, LaTeX & HTML › Forums › asdocx Forum › Ttest results, rounding and missing values
Tagged: asdocx, decimal points, exponential format
-
AuthorPosts
-
Hi Dr. Shah,
I am trying to understand why some of the values are not showing in my
ttest
results.
Here is the code that I useasdocx ttest hnr if Sentiment >0, by(Sentiment) /// stat(obs mean se sd dif t p) c2_tzok c2_dec(0) /// c3_tzok c3_dec(0) c4_tzok c4_dec(10) c5_tzok /// c5_dec(10) c6_tzok c6_dec(10) c7_tzok c7_dec(10) /// c8_tzok c8_dec(10) c9_tzok c9_dec(10)
Here is an example:
I expect to see the following values under the mean and stdev in the t test results. I am pasting the results from part of ttest table for two variables.
Var - hnr Two-sample t test with equal variances ------------------------------------------------------------------------------ Group | Obs Mean Std. err. Std. dev. [95% conf. interval] ---------+-------------------------------------------------------------------- Pos | 3557765 -.0000301 2.89e-07 .0005454 -.0000306 -.0000295 Neg | 608,190 -.000026 6.63e-07 .0005172 -.0000273 -.0000247 Var - jitter Two-sample t test with equal variances ------------------------------------------------------------------------------ Group | Obs Mean Std. err. Std. dev. [95% conf. interval] ---------+-------------------------------------------------------------------- Pos | 3557765 .0257654 3.36e-06 .0063411 .0257588 .025772 Neg | 608,190 .0255683 8.12e-06 .0063336 .0255524 .0255842
However, the results do not have those. It looks like if the values is very small, it does not get copied. I run for several variables and I get the same results for small values.
T-Test of differences for all AudioFeaturesobs1 obs2 Mean1 Mean2 St_Err St_Dev1 St_Dev2 dif t_value p_value hnr 3557765 608190 0.0000000000 0.0000000000 0.0000000000 0.0005000000 0.0005000000 0.0000000000 -5.4 0 Jitter loc 3557765 608190 0.0260000000 0.0255000000 0.0000000000 0.0065000000 0.0065000000 0.0000000000 22.4 0 Notes: From the results, it looks like, I am not getting mean, sterror and diff values for the hnr and stdev values seems rounded.
I am getting same results for the second variable, except I am getting rounded mean values.Thank you.
Ozer Erdem
I have updated asdocx. It now fixes the decimal points problem in thettest
results. You should now be able to see accurate decimal points in your results.Additionally, for very small values, using the
c#_disfmt(%9.4e)
format is a better way to report values in exponential format. For example, instead of seeing0.00000009
, you would see9.00e-08
. This helps in making the results easier to read and understand.asdocx_update
Here is an example:
* Create a dummy dataset clear input float group double score 1 .0000012 1 .000015 1 .0000214 2 .011 2 .039 2 .0610 end * Report 7 decimal places for the column 4 asdocx ttest score, replace c4_dec(7) by(group) stat(obs mean t) Table: Results 0 |1 2 3 4 5 6 ----+------------------------------------------------------------------------------------------ 1 | obs1 obs2 Mean1 Mean2 t_value ----+------------------------------------------------------------------------------------------ 2 |score by group: 1 2 3 3 0.0000125 0.037 -2.556 ----------------------------------------------------------------------------------------------- * Report exponential format for column 4 asdocx resetfmt asdocx ttest score, replace tzok c4_disfmt(%9.4e) by(group ) stat(obs mean t) Two-sample t test with equal variances ------------------------------------------------------------------------------ Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] ---------+-------------------------------------------------------------------- 1 | 3 .0000125 5.96e-06 .0000103 -.0000131 .0000382 2 | 3 .037 .0144684 .0250599 -.0252523 .0992523 ---------+-------------------------------------------------------------------- combined | 6 .0185063 .010501 .025722 -.0084873 .0454999 ---------+-------------------------------------------------------------------- diff | -.0369875 .0144684 -.0771581 .0031831 ------------------------------------------------------------------------------ diff = mean(1) - mean(2) t = -2.5564 Ho: diff = 0 degrees of freedom = 4 Ha: diff < 0 Ha: diff != 0 Ha: diff > 0 Pr(T < t) = 0.0314 Pr(|T| > |t|) = 0.0629 Pr(T > t) = 0.9686 Table: Results 0 |1 2 3 4 5 6 ----+---------------------------------------------------------------------------------------- 1 | obs1 obs2 Mean1 Mean2 t_value ----+---------------------------------------------------------------------------------------- 2 |score by group: 1 2 3.000 3.000 1.25e-05 0.037 -2.556 --------------------------------------------------------------------------------------------- Notes:
Very helpful.
Thank you Dr. Shah.Ozer
-
AuthorPosts
- You must be logged in to reply to this topic.