Stata 11 help for prtest

help prtest, help prtestti dialogs: one-sample two-sample two-sample, by() immediate dialogs: one-sample two-sample -------------------------------------------------------------------------------

Title

[R] prtest -- One- and two-sample tests of proportions

Syntax

One-sample test of proportion

prtest varname == #p [if] [in] [, level(#)]

Two-sample test of proportion

prtest varname1 == varname2 [if] [in] [, level(#)]

Two-group test of proportion

prtest varname [if] [in] , by(groupvar) [level(#)]

Immediate form of one-sample test of proportion

prtesti #obs1 #p1 #p2 [, level(#) count]

Immediate form of two-sample test of proportion

prtesti #obs1 #p1 #obs2 #p2 [, level(#) count]

by is allowed with prtest; see [D] by.

Menu

one-sample

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > One-sample proportion test

two-sample

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > Two-sample proportion test

two-group

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > Two-group proportion test

immediate command: one-sample

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > One-sample proportion calculator

immediate command: two-sample

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > Two-sample proportion calculator

Description

prtest performs tests on the equality of proportions using large-sample statistics.

In the first form, prtest tests that varname has a proportion of #p. In the second form, prtest tests that varname1 and varname2 have the same proportion. In the third form, prtest tests that varname has the same proportion within the two groups defined by groupvar.

prtesti is the immediate form of prtest; see immed.

The bitest command is a better version of the first form of prtest in that it gives exact p-values. Researchers should use bitest when possible, especially for small samples; see [R] bitest.

Options

+------+ ----+ Main +-------------------------------------------------------------

by(groupvar) specifies a numeric variable that contains the group information for a given observation. This variable must have only two values. Do not confuse the by() option with the by prefix; both may be specified.

level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level.

count specifies that integer counts instead of proportions be used in the immediate forms of prtest. In the first syntax, prtesti expects that #obs1 and #p1 are counts -- #p1 < #obs1 -- and #p2 is a proportion. In the second syntax, prtesti expects that all four numbers are integer counts, that #obs1 > #p1, and that #obs2 > #p2.

Examples

--------------------------------------------------------------------------- Setup . sysuse auto

One-sample test of proportion . prtest foreign==.4

--------------------------------------------------------------------------- Setup . webuse cure

Two-sample test of proportion . prtest cure1==cure2

--------------------------------------------------------------------------- Setup . webuse cure2

cure has same proportion for males and females . prtest cure, by(sex)

Immediate form of one-sample test of proportion . prtesti 50 .52 .70

First two numbers are counts . prtesti 30 4 .7, count

Immediate form of two-sample test of proportion . prtesti 30 .4 45 .67

All numbers are counts . prtesti 30 4 45 17, count ---------------------------------------------------------------------------

Saved results

prtest and prtesti save the following in r():

Scalars r(z) z statistic r(P_#) proportion for variable # r(N_#) number of observations for variable #

Also see

Manual: [R] prtest

Help: [R] bitest, [MV] hotelling, [R] proportion, [R] ttest


© Copyright 1996–2009 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index