I have a data set that consists of the dates of certain arbitrary events
(hospital appointments), together with various predictors; mainly
date, numeric code for referring doctor (GP) & intervention (pre/post ).
I am interested in whether the intervention is associated with a fall in
the monthly rate of appointments, after adjusting for secular trend
and clustering by GP.
One approach is to collapse the data & perform a Poisson or negative
binomial regression. However, the code needed for this is surprisingly
complex (see below), as I need to ensure that the practices with zero
frequencies in
one time period are properly included, and the only way I could see to do this
was to tabulate, save the table as a matrix and then convert it to a data set.
Two questions:
1) Is there a simpler way of collapsing the data without the zero problem
2) Is there a way of analysing the data using it's present structure (or
something like it)?
Any thought gratefully received.
. use "westminster2", clear
. li uniqid aptdate apttype pre_ post_ in 1/5
+----------------------------------------------+
| uniqid aptdate apttype pre_ post_ |
|----------------------------------------------|
1. | 6220 11 Apr 02 first vi 0 1 |
2. | 6159 12 Mar 02 first vi 0 1 |
3. | 6175 21 Mar 02 first vi 0 1 |
4. | 6210 09 Apr 02 first vi 0 1 |
5. | 6165 14 Mar 02 first vi 0 1 |
+----------------------------------------------+
tempname temp
tab refcode prepost if hosp == 1, matcell(temp) matrow(gp_ref_cd)