# Re: st: Test for trend for SIR

 From "roland andersson" To statalist@hsphsun2.harvard.edu Subject Re: st: Test for trend for SIR Date Tue, 13 Nov 2007 09:09:05 +0100

```I have individual data with multiple records per patient after I have
split the follow up time depending on year and age and have merged a
variable for the incidence rate per 100.000 personyears. With the
command

xi:strate i.timeperiod,smr(inc) per (100000)

I get the following result

+-----------------------------------------------------------+
timeperiod    D      E      SMR   Lower    Upper
-----------------------------------------------------------
1                 7   0.43   16.102   7.677   33.777
2                 5   1.65    3.032   1.262    7.284
3               14   2.11    6.642   3.934   11.215
+-----------------------------------------------------------+

I want to test for the linear trend over the timeperiods.

If I try the smrby on this result I get:

. smrby D E, by(timeperiod) trend

Observed    Expected	-- Poisson	Exact --
timeperiod   D           E              O/E (%)	[95% Conf.	Interval]

1                   7      0.4300      1627.9***	655	3354
2                   5      1.6500       303.0	98	707
3                  14      2.1100       663.5***	363	1113
may not use noninteger frequency weights
r(401);

Why do I get this error message?

According to your second choice I use the following model on this result.

glm D timeperiod, family(poisson) lnoffset(E) eform

Iteration 0:   log likelihood = -9.6767233
Iteration 1:   log likelihood = -9.5071336
Iteration 2:   log likelihood = -9.5068971
Iteration 3:   log likelihood = -9.5068971

Generalized linear models                          No. of obs      =	3
Optimization     : ML                              Residual df     =	1
Scale parameter =	1
Deviance         =  7.236772128                    (1/df) Deviance =	7.236772
Pearson          =  6.884656839                    (1/df) Pearson  =	6.884657

Variance function: V(u) = u                        [Poisson]
Link function    : g(u) = ln(u)                    [Log]

AIC             =	7.671265
Log likelihood   = -9.506897131                    BIC             =	6.13816

OIM
D         IRR   Std. Err.      z    P>z     [95% Conf.	Interval]

timeperiod    .7561818   .2108008    -1.00   0.316     .4378616	1.305917
E  (exposure)

ie there is no linear trend p=0.316

Is this a correct use of the glm model? Or can I use some other method
on the original dataset? If I collapse the dataset what happens with
the incidensvariable which should not be aggregated but stay the same.
Or do I have to collapse the dataset and merge the incidensvariable
after the collapse?

2007/10/18, raoul reulen <r.c.reulen@gmail.com>:
> Hi
>
> I'm not exactly sure what you want to do, but the title of the message
> suggests you want to do a test for linear trend accros several SIRs.
> What I normally do is use smrby.ado because it includes a test for
> trend and heterogeneity. Alternatively, you might want to model the
> SIRs by using a GLM model with a Poisson error structure and then fit
> the factor of interest as a consecutive non-negative integer variable.
> Make sure you collapse your data before you model it.
>
> .collapse (sum) _d E pyrs, by(timeperiod)
> .xi, noomit:glm _d i.timeperiod if E!=0,fam(pois) lnoffset(E)  eform  noconstant
>
> gives you the SIRs
>
> .xi, noomit:glm _d timeperiod if E!=0,fam(pois) lnoffset(E)  eform  noconstant
>
> gives you the p-value for linear trend
>
> _d is the numner of events, E the number of expected. The p-value for
> timeperiod should give you the test for linear trend accross the
> groups.
>
>
> Hope it helps
>
> Raoul Reulen
> Cancer Research UK Graduate Training Fellow
>
>
>
>
>
> > I have used strate.ado to calculate standardised incidence ratios with
> > standardisation for age, sex and timepriod. I want to make inferences
> > on the development of the SIRs over three timeperiods. Can you help me
> > with instruction how to do this?
> > *
> > *   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/
> >
>
>
> --
> -------------------------------------------------------
> Raoul C. Reulen
> Cancer Research UK Training Fellow
> *
> *   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/
>
*
*   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/
```