*! version 1.1.3 26oct2014
help ptrend

Title

ptrend, ptrendi -- Trend analysis for proportions

Syntax

ptrend rvar nrvar xvar

ptrendi r1 nr1 x1 \ r2 nr2 x2
\ r3 nr3 x3 [ \ r4 nr4 x4 ... ]

Description

ptrend calculates a chi-square statistic for the trend (regression) of pvar
on xvar, where pvar is the proportion rvar/(rvar + nrvar). A variable called
_prop, containing the values of pvar, is left behind by ptrend.
ptrend also gives a chi-square test for departure from the trend line.

ptrendi does the same analysis on user-entered data; the proportions are now
p1 = r1/(r1 + nr1), p2 = r2/(r2 + nr2), ....

ptrendi is an "immediate" command; see [U] immediate.

Options

None.

Examples

. ptrend r nr x

. ptrend yes no shoesize

. ptrendi 24 1355 1 \ 35 603 2 \ 21 192 3 \ 30 224 4

Stored

ptrend and ptrendi store in r():

scalar r(slope) Regression slope
scalar r(se) Standard error of slope
scalar r(chi2trend) Chisquare for trend
scalar r(chi2overall) Pearson chisquare for the contingency table
scalar r(chi2dep) Chisquare for departure from linear trend
scalar r(dfdep) Degrees of freedom for r(chi2dep)}
scalar r(Pdep) P-value for departure from linear trend

Author

Patrick Royston

MRC Clinical Trials Unit at UCL, London WC2B 6NH, UK.

Email: Patrick Royston

Also see

Online: help for tabulate