Statalist


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

Re: st: Testing for Trend Linearity


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Testing for Trend Linearity
Date   Fri, 5 Sep 2008 09:18:41 +0100 (BST)

--- [email protected] wrote:
> I ran (in stata 9)
> xi: xtpois injury age, i(id)
> xi: xtpois injury age i.ageg, i(id)
> where "injury" is a binary variable, "age" is continuous and "ageg"
> is  "age" as a categorical variable. All the p-values (age, _Iageg_2,
> and _Iageg_3) were >0.05.
> Does this imply the trend does not deviate from linearity (at the
> 0.05 level)?

No, for two reasons:

1) _Iageg_2 and _Iageg_3 represent a deviation from the linear trend
within their interval. So the hypothesis would be _Iageg_2 and
_Iagage_3 are both simultaneously equal to zero. The way to test such
an hypothesis is to use -test- or convenient shortcuts exist when using
-testparm-.

2) This is not a test of non-linearity, but a test of one particular
and peculiar type of non-linearity: you are creating a sort of step
function with sloping steps. The example gives shows graphs of the
linear and non-linear trend. If you think population averaged models
are ok for your situation than -fracpoly- and -mvrs- are very nice
alternatives. -fracpoly- is part of official Stata, so more on that can
be found by typing -help fracpoly-. -mvrs- is described in (Royston and
Sauerbrei 2007)

The example also shows a problem with using -poisson-, and -xtpoisson-
for binary data: There is no way to restrict the predicted
probabilities to be less than 1. For that reason using -logit- and
-xtlogit- is preferable, especially if you have continuous covariates.

Hope this helps,
Maarten

*------------- begin example ------------------
sysuse auto, clear
poisson foreign mpg
predict ir_lin

egen mpg_g = cut(mpg), group(3)
xi: poisson foreign mpg i.mpg_g
testparm _Impg_g*
predict ir_nonlin

twoway line ir_* mpg, sort 
*---------------- end example -----------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Patrick Royston and Willi Sauerbrei (2007) Multivariable modeling with
cubic regression splines: A principled approach. The Stata Journal
7(1): 45--70. 
http://www.stata-journal.com/article.html?article=st0120


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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