Roland,
Rather than change the ado file, you can change E (the expected number of
events) to an integer, - replace E= round(100*E) and then - smrby D E,
by(timeperiod) trend -.
The trend test is still appropriate since it depends on the relative, not
the absolute, sizes of the timeperiod groupings.
Hope this helps.
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?
Roland Andersson
*
* 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/