

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Stata commands and examples for conducting inference for proportions using one-sample and two-sample tests in the context of sociological research. The use of normal distribution functions, one-sample t-tests, and two-sample tests for proportions.
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


University of North Carolina Chapel Hill
Professor François Nielsen
followed by the name of the command in Stata.
For confidence intervals, also see page 35 of the Stata and SAS Guide pdf
(click on Documents in side bar; guide is linked under Software Documenta-
tion).
1.1 Normal Distribution Functions
curve to the left of z. (Compare with Table A.)
. display normal(1.207) .
the area under the standard normal curve to the left of z is p. (Compare with
Table A and Table D (bottom row).)
. display invnormal(0.975)
When inputting the data in summary form, i.e. we don’t have the individual
(number of successes).
. * Binge Drinking example p. 490 . * Note hypothesis p0 = 0.5 makes no sense here; we still get correct CI . prtesti 13819 3140 0.5, level(95) count
Variable | Mean Std. Err. [95% Conf. Interval] -------------+---------------------------------------------------------------- x | .2272234 .0035646 .2202368.
p = proportion(x) z = -64.
Ho: p = 0.
Ha: p < 0.5 Ha: p != 0.5 Ha: p > 0. Pr(Z < z) = 0.0000 Pr(|Z| > |z|) = 0.0000 Pr(Z > z) = 1.
. * Work Stress example p. 494 . prtesti 100 68 0.75, level(95) count
Variable | Mean Std. Err. [95% Conf. Interval] -------------+---------------------------------------------------------------- x | .68 .0466476 .5885724.
p = proportion(x) z = -1. Ho: p = 0.
Ha: p < 0.75 Ha: p != 0.75 Ha: p > 0. Pr(Z < z) = 0.0530 Pr(|Z| > |z|) = 0.1060 Pr(Z > z) = 0.
. * Gallup Poll 22 Oct 2008, n=2788, 51% favor Obama (43% McCain, 6% Undecided) . prtesti 2788 0.51 0.5, level(95)
Variable | Mean Std. Err. [95% Conf. Interval] -------------+---------------------------------------------------------------- x | .51 .0094675 .491444.
p = proportion(x) z = 1. Ho: p = 0.
Ha: p < 0.5 Ha: p != 0.5 Ha: p > 0. Pr(Z < z) = 0.8545 Pr(|Z| > |z|) = 0.2910 Pr(Z > z) = 0.
The syntax for a two sample test, when inputting the data in summary form, is
. * sample of middle-ages men takin experimental drug or placebo . * n1=2051 taking drug, n2=2030 placebo . * X1=56, X2=84 are numbers with heart attack for drug and placebo, resp. . prtesti 2051 56 2030 84, count level(90)
Two-sample test of proportion x: Number of obs = 2051 y: Number of obs = 2030
Variable | Mean Std. Err. z P>|z| [90% Conf. Interval] -------------+---------------------------------------------------------------- x | .0273038 .0035985 .0213848. y | .0413793 .0044205 .0341083. -------------+---------------------------------------------------------------- diff | -.0140756 .0056999 -.0234511 -. | under Ho: .0056984 -2.47 0.