Dear all,
I have a problem related to a dataset in which each row represents a hospitalization in a pediatric psychiatry.
For each patient (id) there is the sex, the year, the fact that the day of hospitalization was school or not, the month, the date and the day of the week (Monday, Tuesday and so on).
I would like to understand if the incidence increases over the years, with the fact that the day is school or not and the interaction of the two factors.
The data is organized like this:
My idea is to create a dataset in which the number of hospitalizations is stratified by year, month and school/non-school day, as suggested to me in a previous post.
The problem I am asking myself is the non-school days are fewer than the school days, unlike the months that have a comparable exposure (about 30 days).
How can I fix this? How should I set the offset?
I have a problem related to a dataset in which each row represents a hospitalization in a pediatric psychiatry.
For each patient (id) there is the sex, the year, the fact that the day of hospitalization was school or not, the month, the date and the day of the week (Monday, Tuesday and so on).
I would like to understand if the incidence increases over the years, with the fact that the day is school or not and the interaction of the two factors.
The data is organized like this:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int year byte sex int admission_date float(idd season school month day) 2014 0 19731 1 3 1 1 3 2014 1 19730 2 3 1 1 2 2014 1 19737 3 3 1 1 2 2014 0 19738 4 3 1 1 3 2014 1 19740 5 3 1 1 5 2014 0 19744 6 3 1 1 2 2014 0 19744 7 3 1 1 2 2014 0 19746 8 3 1 1 4 2014 0 19756 9 3 0 2 0 2014 0 19757 10 3 1 2 1 2014 1 19759 11 3 1 2 3 2014 0 19764 12 3 1 2 1 2014 0 19768 13 3 1 2 5 2014 1 19770 14 3 0 2 0 2014 1 19773 15 3 1 2 3 2014 1 19775 16 3 1 2 5 2014 1 19779 17 3 1 2 2 2014 1 19781 18 3 1 2 4 2014 0 19781 19 3 1 2 4 2014 0 19782 20 3 1 2 5 2014 0 19784 21 3 0 3 0 2014 0 19785 22 3 0 3 1 2014 1 19786 23 3 0 3 2 2014 1 19786 24 3 0 3 2 2014 0 19791 25 3 0 3 0 2014 1 19791 26 3 0 3 0 2014 1 19792 27 3 1 3 1 2014 1 19794 28 3 1 3 3 2014 0 19800 29 3 1 3 2 2014 1 19801 30 3 1 3 3 2014 1 19803 31 0 1 3 5 2014 0 19805 32 0 0 3 0 2014 1 19806 33 0 1 3 1 2014 0 19809 34 0 1 3 4 2014 1 19813 35 0 1 3 1 2014 0 19814 36 0 1 4 2 2014 0 19815 37 0 1 4 3 2014 1 19817 38 0 1 4 5 2014 1 19817 39 0 1 4 5 2014 1 19821 40 0 0 4 2 2014 1 19823 41 0 0 4 4 2014 0 19823 42 0 0 4 4 2014 1 19824 43 0 0 4 5 2014 1 19824 44 0 0 4 5 2014 1 19832 45 0 0 4 6 2014 1 19841 46 0 1 4 1 2014 1 19842 47 0 1 4 2 2014 0 19848 48 0 1 5 1 2014 0 19851 49 0 1 5 4 2014 0 19851 50 0 1 5 4 2014 1 19852 51 0 1 5 5 2014 1 19854 52 0 0 5 0 2014 0 19855 53 0 1 5 1 2014 0 19856 54 0 1 5 2 2014 1 19857 55 0 1 5 3 2014 1 19857 56 0 1 5 3 2014 1 19858 57 0 1 5 4 2014 1 19859 58 0 1 5 5 2014 1 19859 59 0 1 5 5 2014 1 19866 60 0 1 5 5 2014 1 19868 61 0 0 5 0 2014 1 19877 62 0 1 6 2 2014 1 19880 63 0 1 6 5 2014 1 19884 64 0 1 6 2 2014 0 19889 65 0 0 6 0 2014 1 19914 66 1 0 7 4 2014 0 19918 67 1 0 7 1 2014 1 19920 68 1 0 7 3 2014 1 19926 69 1 0 7 2 2014 1 19928 70 1 0 7 4 2014 1 19932 71 1 0 7 1 2014 1 19942 72 1 0 8 4 2014 1 19948 73 1 0 8 3 2014 0 19954 74 1 0 8 2 2014 1 19957 75 1 0 8 5 2014 1 19964 76 1 0 8 5 2014 1 19965 77 1 0 8 6 2014 0 19974 78 1 1 9 1 2014 1 19975 79 1 1 9 2 2014 0 19975 80 1 1 9 2 2014 1 19975 81 1 1 9 2 2014 0 19976 82 1 1 9 3 2014 0 19985 83 1 1 9 5 2014 0 19987 84 1 0 9 0 2014 1 19988 85 1 1 9 1 2014 1 19989 86 2 1 9 2 2014 0 19991 87 2 1 9 4 2014 1 19991 88 2 1 9 4 2014 1 19994 89 2 0 9 0 2014 1 19995 90 2 1 9 1 2014 1 19995 91 2 1 9 1 2014 1 19996 92 2 1 9 2 2014 1 19997 93 2 1 10 3 2014 1 19997 94 2 1 10 3 2014 1 19998 95 2 1 10 4 2014 1 19999 96 2 1 10 5 2014 0 19999 97 2 1 10 5 2014 0 20005 98 2 1 10 4 2014 1 20007 99 2 0 10 6 2014 0 20009 100 2 1 10 1 end format %td admission_date label values season stal label def stal 0 "Primavera", modify label def stal 1 "Estate", modify label def stal 2 "Autunno", modify label def stal 3 "Inverno", modify label values school scuolal label def scuolal 0 "Non scolastico", modify label def scuolal 1 "Scolastico", modify label values month mesel label def mesel 1 "Gennaio", modify label def mesel 2 "Febbraio", modify label def mesel 3 "Marzo", modify label def mesel 4 "Aprile", modify label def mesel 5 "Maggio", modify label def mesel 6 "Giugno", modify label def mesel 7 "Luglio", modify label def mesel 8 "Agosto", modify label def mesel 9 "Settembre", modify label def mesel 10 "Ottobre", modify
Code:
collapse (count) admissions = idd , by(month school year) poisson admissions i.month i.school i.year poisson admissions i.month i.school##i.year
How can I fix this? How should I set the offset?
Comment