Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
David Lempert <david.lempert@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: comparing different means using ttest |

Date |
Thu, 16 Dec 2010 14:54:19 +0100 |

I apologize beforehand if this question is a bit trivial, but I have run into a problem and I can't seem to find the solution in any previous statalist correspondence I have come across. I am currently using a two-sample t-test with equal variances to compare the % GDP-growth between 2 periods and I am trying to figure out if my method has been correct. The following is part of the code I've used: reg gdp_ year predict res, r sum res (I check and see if the mean is close to zero, which it is - hence homoscedastic as I see it) pnorm res (I see if the residuals are normally distributed, which it looks to me as if they are - they are all relatively close to the trend-line) The gdp data I have is quarterly, due to the fact that I am only investigating 8 years and need it to be normally distributed. The pnorm test seems to confirm that this is the case. I after this generate a code for the percentual gdp-growth for period 1 and for period 2 - the main thing I want to examine. gen percdiff1 = (gdp_[_n] - gdp_[_n-4]) / gdp_[_n-4] if year<=20034 gen percdiff2 = (gdp_[_n] - gdp_[_n-4]) / gdp_[_n-4] if year>=20041 sum percdiff1 sum percdiff2 sdtest.... (this is to check and see that they have equal variances, degrees of freedom is 15, 15 and f-value is 1.2392 which is smaller than all critical f-values in any table I have access to, so I can not reject the null hypothesis that the ratio of their standard deviations is 1, hence equal variances) ttest percdiff1=percdiff2, unpaired I get the following printout: ------------------------------------------------------------------------------ | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] ---------+-------------------------------------------------------------------- percdi~1 | 16 .0714719 .004791 .019164 .0612601 .0816837 percdi~2 | 16 .1033814 .0043038 .0172151 .0942081 .1125547 ---------+-------------------------------------------------------------------- combined | 32 .0874267 .0042715 .0241634 .0787148 .0961385 ---------+-------------------------------------------------------------------- diff | -.0319094 .0064402 -.0450621 -.0187568 ------------------------------------------------------------------------------ diff = mean(percdiff1) - mean(percdiff2) t = -4.9547 Ho: diff = 0 degrees of freedom = 30 Ha: diff < 0 Ha: diff != 0 Ha: diff > 0 Pr(T<t) = 0.0000 Pr(|T|>|t|) = 0.0000 Pr(T>t) = 1.0000 And, I can reject the null-hypothesis that the means for each period is equal on an alfa=0.05 significance level. My first question is: Have I done this correctly? This is for my thesis paper and I will have to defend this in the beginning of January. My second question is: Can I say that the difference is negative from these numbers? I ask because I am trying to prove that the mean for percdiff2 is greater than the mean for percdiff1. Thanks a lot, David Student at Stockholm University * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: RE: comparing different means using ttest***From:*Nick Cox <n.j.cox@durham.ac.uk>

**Re: st: comparing different means using ttest***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**Re: st: how to fill some gross wage missings if I have the net wage** - Next by Date:
**Re: st: comparing different means using ttest** - Previous by thread:
**st: Small strata and test of proportional hazard assumption** - Next by thread:
**Re: st: comparing different means using ttest** - Index(es):