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]
Re: st: one-sample t test query
From
Phil Schumm <[email protected]>
To
Statalist Statalist <[email protected]>
Subject
Re: st: one-sample t test query
Date
Mon, 13 Jan 2014 04:21:43 -0600
On Jan 13, 2014, at 3:21 AM, Gwinyai Masukume <[email protected]> wrote:
> I have a dataset with 32 observations (20 females and 12 males). Males thus constitute 37.5% of the observations. Normally males should constitute 51.5% of the observations. I want to test if the observed 37.5% males are different from 51.5%. I have issued the following Stata command:
>
> . ttest sex_baby = 0.515
>
> One-sample t test
> ------------------------------------------------------------------------------
> Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
> ---------+--------------------------------------------------------------------
> sex_baby | 32 .375 .086951 .4918694 .1976622 .5523378
> ------------------------------------------------------------------------------
> mean = mean(sex_baby) t = -1.6101
> Ho: mean = 0.515 degrees of freedom = 31
>
> Ha: mean < 0.515 Ha: mean != 0.515 Ha: mean > 0.515
> Pr(T < t) = 0.0588 Pr(|T| > |t|) = 0.1175 Pr(T > t) = 0.9412
>
> Looking at the two-tailed p-value, I conclude that 37.5% is not significantly different from 51.5% if p < 0.05 is considered significant.
> Have I used the correct Stata command and is my interpretation correct?
Since your variable sex_baby is binary (taking values 0 or 1) you want to use -bitest- instead, which will give you an exact p-value based on the binomial distribution. Specifically, you would use
bitest var1 = 0.515
which in this case yields a two-sided p-value of 0.156. Thus, you cannot reject the null hypothesis (H0: p = 0.515) at the 0.05 level.
Alternatively, with a large enough sample size, you can approximate the distribution of the sample proportion with the Normal distribution, but with a variance of p(1-p)/n (this differs from the variance you obtained above by a factor of (n-1)/n). In Stata, you can perform this calculation using the command -prtest-. Note that this approximation is improved by use of the continuity correction.
-- Phil
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/