[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Joseph Coveney <jcoveney@bigplanet.com> |

To |
Statalist <statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: chi2 test for linear trend for repeated data |

Date |
Tue, 03 Jun 2003 22:27:30 +0900 |

Alvine Bissery posted, > I'm studing a group of subject with repeated measures in time. > Measurements are expressed as proportions, and I would like to do a chi2 > test to test linear trend for these repeated data ... that means , a kind of > "nptrend" but for repeated data > > Does this test exist ? Below are two suggestions for a linear trend test for repeated proportions. Note that, since it wouldn't seem that a nonparametric test (such as an analogue of -nptrend-) would give a test for linear trend, therefore both suggestions are parametric methods. First, if the measurements are obtained only as proportions (and not as *x* successes out of *n* trials), then I recommend performing a randomized-blocks (repeated- measures) analysis of variance after arcsin transformation of the individual proportions. Proportions are narrowly bounded, so I'm guessing that there would be a rather small range over which a strictly linear trend would be observed for any regressor for untransformed observations. The transformation method for proportions is described in B. J. Winer, D. R. Brown and K. M. Michels, _Statistical Principles in Experimental Design_ Third Edition. (New York: McGraw-Hill, 1991), pp. 356-57. So, for example, if *pro* is the dependent variable and *tim* is the time variable over which repeated measurements are made, then the code for a test of linear trend in the proportions over time would look something like in the first case in the illustrative do-file attached below. Testing for linear trend using orthogonal polynomial contrasts is also described in Winer, Brown and Michels, pp. 198 ff. Second, if the proportions are expressing measurements that are actually obtained as *x* successes out of *n* trials, then I recommend to use logistic regression in some form. I've used -xtgee- below to illustrate this second case, but -xtlogit- is an alternative to the population-average approach. Polynomial contrasts can test for trend here, too, but the functional form of the relationship isn't one of proportions versus time, so "linear" won't mean quite the same in the logistic model as when a difference-of- proportions (risk-difference) model is fitted. The risk-difference model is illustrated last in the do-file below. This latter, although it retains the sense of linear trend of proportions over time, doesn't seem like a natural parameterization of the phenomenon, and I suspect that it could predict proportions less than zero or greater than one. Joseph Coveney -------------------------------------------------------------------------------- * Creating artificial data for illustration: clear set more off set seed 20030603 set seed0 20030603 set obs 10 generate byte pid = _n generate byte den = 100 generate float mu_i = uniform() forvalues i = 2(2)10 { generate float mu_j = (mu_i * 5 + uniform() * 5 + `i') / 20 quietly rndbinx mu_j den rename bnlx num`i' drop mu_j } drop mu_i quietly reshape long num, i(pid) j(tim) generate float pro = num / den * * Demonstration of the first case follows: * replace pro = pro + 1 / 200 if pro == 0 replace pro = pro - 1 / 200 if pro == 1 generate float apr = 2 * asin(sqrt(pro)) desmat: xtreg apr tim, verbose defcon(orp(4)) desrep(all) i(pid) fe * The first orthogonal polynomial contrast in the output above * is the term for linear trend. It is the coefficient _x_1 * generated by -orthpoly- via -desmat-. * * Demonstration of the second case follows: * xtgee num _x_*, i(pid) t(tim) family(binomial den) /* */ link(logit) corr(unstructured) nmp nolog * The coefficient _x_1 is the term for linear trend. * * Risk-difference parameterization: * xtgee num _x_*, i(pid) t(tim) family(binomial den) /* */ link(identity) corr(unstructured) nmp nolog predict num_hat, mu replace num_hat = num_hat / 100 /* A bug in -xtgee- & -predict-? */ generate pro_hat = num_hat / den table tim, contents(mean pro mean pro_hat) format(%4.2f) exit -------------------------------------------------------------------------------- * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: highest scalar of a matrix***From:*"Joao Pedro W. de Azevedo" <jazevedo@provide.com.br>

- Prev by Date:
**st: RE: RE: SAVE GRAPHICS PNG** - Next by Date:
**st: FPC & 2-stage cluster sampling** - Previous by thread:
**st: RE: RE: SAVE GRAPHICS PNG** - Next by thread:
**st: highest scalar of a matrix** - Index(es):

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