Dear all,
I have a dataset in which each row represents a hospitalization in a pediatric psychiatry.
For each patient (id) there is the sex, year, diagnosis (from diagnosis1 to diagnosis13), whether the day of hospitalization was a school day or not, the month and the season.
I would like to understand if the incidence increases over the years, and if over the years for example one sex increases compared to the other, or one diagnosis compared to the other etc.
The data is organized like this:
My idea is to collapse to monthly counts, stratified by sex, diagnosis, etc., and then do a regression by counts.
I would do it like this:
I would not put any offset because I assume that each month is more or less of equal length.
I'd possibly evaluate the interaction:
Am I doing something wrong?
Do you think this give me the answer I'm asking data?
Thank you very much for your help.
Gianfranco
I have a dataset in which each row represents a hospitalization in a pediatric psychiatry.
For each patient (id) there is the sex, year, diagnosis (from diagnosis1 to diagnosis13), whether the day of hospitalization was a school day or not, the month and the season.
I would like to understand if the incidence increases over the years, and if over the years for example one sex increases compared to the other, or one diagnosis compared to the other etc.
The data is organized like this:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int(year id) double age byte sex str9 month str6 stagione str10 school byte(diagnosis1 diagnosis2 diagnosis3 diagnosis4 diagnosis5 diagnosis6 diagnosis7 diagnosis8 diagnosis9 diagnosis10 diagnosis11 diagnosis12 diagnosis13) 2014 14 14 0 "January" "Winter" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 64 15.2 1 "January" "Winter" "School" 0 1 0 0 0 0 1 1 1 1 0 0 0 2014 40 17.3 1 "January" "Winter" "School" 0 1 1 0 0 0 0 1 0 0 1 0 0 2014 66 17.7 0 "January" "Winter" "School" 0 0 0 1 0 0 0 0 0 0 0 1 0 2014 67 16.3 1 "January" "Winter" "School" 0 0 0 0 0 0 0 0 0 0 0 1 0 2014 68 14.9 0 "January" "Winter" "School" 0 0 1 0 0 0 0 0 0 0 0 1 0 2014 61 12.1 0 "January" "Winter" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 69 15.8 0 "January" "Winter" "School" 0 0 0 0 0 0 0 0 0 0 1 1 0 2014 66 17.8 0 "February" "Winter" "Non School" 0 0 0 1 0 0 0 0 0 0 0 0 0 2014 17 15.7 0 "February" "Winter" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 72 14.6 1 "February" "Winter" "School" 0 0 0 0 0 0 0 0 0 0 0 0 1 2014 50 12.9 0 "February" "Winter" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 74 16.5 0 "February" "Winter" "School" 0 0 0 0 0 0 0 1 1 0 0 0 0 2014 75 18.9 1 "February" "Winter" "Non School" 0 0 0 1 0 0 0 0 0 0 0 0 0 2014 35 17.4 1 "February" "Winter" "School" 0 0 0 1 0 0 0 0 0 0 0 0 0 2014 79 17.7 1 "February" "Winter" "School" 0 1 0 0 0 0 0 0 0 1 0 0 0 2014 82 14.6 1 "February" "Winter" "School" 0 0 1 0 0 0 0 0 0 0 1 0 1 2014 22 16.4 1 "February" "Winter" "School" 1 0 0 0 0 0 0 1 0 0 0 0 0 2014 17 15.7 0 "February" "Winter" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 43 16.4 0 "February" "Winter" "School" 1 0 0 0 0 0 0 1 0 0 0 0 0 2014 84 14.7 0 "March" "Winter" "Non School" 0 1 0 0 0 0 0 0 0 0 0 0 0 2014 83 16.9 0 "March" "Winter" "Non School" 0 1 0 0 0 0 0 1 0 0 0 0 0 2014 85 17.7 1 "March" "Winter" "Non School" 0 0 0 0 0 0 0 1 0 0 1 0 0 2014 38 15 1 "March" "Winter" "Non School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 86 18.9 0 "March" "Winter" "Non School" 0 0 1 1 0 0 0 0 0 0 0 1 0 2014 87 17.9 1 "March" "Winter" "Non School" 0 1 1 0 0 0 0 1 1 0 0 1 1 2014 88 15.8 1 "March" "Winter" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 38 15 1 "March" "Winter" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 61 12.2 0 "March" "Winter" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 71 15.8 1 "March" "Winter" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 40 17.5 1 "March" "Spring" "School" 0 1 1 0 0 0 0 1 0 0 1 0 0 2014 43 16.5 0 "March" "Spring" "Non School" 1 0 0 0 0 0 0 1 0 0 0 0 0 2014 94 12.8 1 "March" "Spring" "School" 0 0 0 1 0 0 0 1 0 0 0 0 0 2014 84 14.8 0 "March" "Spring" "School" 0 1 1 0 0 0 0 0 0 1 0 0 0 2014 40 17.5 1 "March" "Spring" "School" 0 1 1 0 0 0 0 1 0 0 1 1 0 2014 83 17 0 "APril" "Spring" "School" 0 1 0 0 0 0 0 0 0 0 0 0 0 2014 96 14.7 0 "APril" "Spring" "School" 0 0 0 1 1 0 1 1 1 0 1 1 0 2014 71 15.9 1 "APril" "Spring" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 52 16.2 1 "APril" "Spring" "School" 1 0 1 0 0 0 0 1 0 0 0 0 0 2014 98 16.6 1 "APril" "Spring" "Non School" 0 0 0 1 0 0 0 0 0 0 0 0 0 2014 94 12.9 1 "APril" "Spring" "Non School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 61 12.3 0 "APril" "Spring" "Non School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 98 16.6 1 "APril" "Spring" "Non School" 0 0 0 1 0 0 0 0 0 0 0 0 0 2014 99 13.5 1 "APril" "Spring" "Non School" 0 0 1 0 0 0 0 1 0 0 0 1 0 2014 94 12.9 1 "APril" "Spring" "Non School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 94 12.9 1 "APril" "Spring" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 40 17.6 1 "APril" "Spring" "School" 0 1 1 0 0 0 0 1 0 0 1 1 0 2014 104 16.3 0 "May" "Spring" "School" 0 0 1 0 0 0 0 1 0 0 0 0 0 2014 105 18.4 0 "May" "Spring" "School" 1 0 0 1 0 0 0 0 0 0 0 0 0 2014 106 10.7 0 "May" "Spring" "School" 0 0 0 1 0 0 0 1 1 0 0 0 0 2014 52 16.3 1 "May" "Spring" "School" 1 0 0 0 0 0 0 1 0 0 0 0 0 2014 107 14.8 1 "May" "Spring" "Non School" 0 0 0 1 0 1 0 0 0 0 1 0 0 2014 80 15.3 0 "May" "Spring" "School" 0 0 0 0 0 0 1 1 0 0 0 0 0 2014 109 14.6 0 "May" "Spring" "School" 0 0 0 0 0 0 1 1 1 0 0 0 0 2014 111 13.8 1 "May" "Spring" "School" 0 0 0 0 0 0 0 0 0 0 1 1 0 2014 112 14.4 1 "May" "Spring" "School" 0 0 0 0 0 0 1 0 1 0 1 1 0 2014 52 16.3 1 "May" "Spring" "School" 1 0 0 0 0 0 0 1 0 0 0 0 0 2014 114 16.1 1 "May" "Spring" "School" 0 0 1 0 0 0 0 0 0 0 0 0 0 2014 115 14.8 1 "May" "Spring" "School" 0 0 0 1 0 0 1 1 1 0 0 0 0 2014 116 17.1 1 "May" "Spring" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 118 15.4 1 "May" "Spring" "Non School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 94 13 1 "June" "Spring" "School" 0 0 0 0 0 0 0 1 0 0 1 0 0 2014 119 15.2 1 "June" "Spring" "School" 0 0 0 1 1 0 0 0 1 0 0 0 0 2014 94 13.1 1 "June" "Spring" "School" 0 0 1 0 0 0 0 1 0 0 0 0 0 2014 120 18 0 "June" "Spring" "Non School" 0 0 1 1 1 0 1 0 0 0 0 1 0 2014 94 13.1 1 "July" "SUmmer" "Non School" 0 0 1 0 0 0 0 1 0 0 0 0 0 2014 30 15.9 0 "July" "SUmmer" "Non School" 0 0 1 1 0 0 0 0 0 0 0 0 0 2014 125 14.8 1 "July" "SUmmer" "Non School" 0 0 1 0 0 0 1 1 0 0 1 0 0 2014 82 15 1 "July" "SUmmer" "Non School" 0 0 0 0 0 0 0 0 0 0 1 0 0 2014 128 16 1 "July" "SUmmer" "Non School" 0 0 0 1 0 0 0 0 0 0 1 0 0 2014 130 17.8 1 "July" "SUmmer" "Non School" 0 0 1 1 0 0 1 0 0 0 0 0 1 2014 132 14.6 1 "August" "SUmmer" "Non School" 0 0 1 1 0 0 0 0 1 0 0 0 0 2014 82 15 1 "August" "SUmmer" "Non School" 0 0 1 0 0 0 0 1 0 0 0 0 0 2014 80 15.6 0 "August" "SUmmer" "Non School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 38 15.5 1 "August" "SUmmer" "Non School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 28 18.7 1 "August" "SUmmer" "Non School" 0 1 1 0 0 0 0 0 0 0 0 0 0 2014 136 17.6 1 "August" "SUmmer" "Non School" 0 0 0 1 0 0 1 1 1 0 0 0 1 2014 106 11.1 0 "September" "SUmmer" "School" 0 0 1 0 0 0 0 1 1 1 0 0 0 2014 139 15.8 1 "September" "SUmmer" "School" 0 0 1 0 0 0 0 0 1 0 1 1 0 2014 124 14 0 "September" "SUmmer" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 82 15.1 1 "September" "SUmmer" "School" 1 0 0 0 0 0 0 1 0 0 0 0 0 2014 141 16.6 0 "September" "SUmmer" "School" 0 0 0 1 1 0 0 0 0 0 0 0 0 2014 145 14.5 0 "September" "SUmmer" "School" 0 0 1 1 0 0 0 0 0 0 0 1 0 2014 109 14.9 0 "September" "SUmmer" "Non School" 0 0 0 0 0 0 1 1 0 0 0 0 0 2014 35 18 1 "September" "SUmmer" "School" 0 1 1 1 0 0 0 0 0 0 1 0 0 2014 94 13.3 1 "September" "Autumn" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 148 15.9 0 "September" "Autumn" "School" 0 1 1 1 1 0 0 1 1 0 0 0 0 2014 127 13.3 1 "September" "Autumn" "School" 0 0 1 0 0 0 0 0 1 0 1 0 0 2014 149 15.2 1 "September" "Autumn" "Non School" 0 0 0 1 0 0 0 0 0 0 0 0 0 2014 150 16.9 1 "September" "Autumn" "School" 0 0 0 0 1 0 0 0 0 0 0 0 0 2014 94 13.4 1 "September" "Autumn" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 40 18 1 "September" "Autumn" "School" 0 1 1 0 0 0 0 1 0 0 1 0 0 2014 94 13.4 1 "October" "Autumn" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 130 17.9 1 "October" "Autumn" "School" 0 0 1 1 0 0 0 0 0 0 0 0 0 2014 38 15.6 1 "October" "Autumn" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 152 16.5 1 "October" "Autumn" "School" 0 0 0 1 0 0 0 0 1 0 0 0 0 2014 17 16.3 0 "October" "Autumn" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 17 16.3 0 "October" "Autumn" "School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 94 13.4 1 "October" "Autumn" "Non School" 0 0 0 0 0 0 0 1 0 0 0 0 0 2014 153 14.5 0 "October" "Autumn" "School" 0 0 1 0 0 0 0 0 1 0 0 0 0 end
I would do it like this:
Code:
collapse (count) admissions = id (mean) age , by(month school year sex) poisson admissions i.year i.sex i.school i.month, irr
I'd possibly evaluate the interaction:
Code:
poisson admissions i.year##i.sex i.school i.month, irr
Do you think this give me the answer I'm asking data?
Thank you very much for your help.
Gianfranco
Comment