This example demonstrates how %GEEZIP is used to model pre and post zero inflated count data with continuous covariates.
The data used in this example was simulated. For each observation , there are three independent continuous covariates , each of which follows a normal distribution . The bivariate pre and post count response satisfies the following marginal ZIP model:
In the simulated data, we set .
The simulated data used to demonstrate is shown below
data mydata;
input id count time x1 x2 x3 @@;
datalines;
1 37 1 0.06155278 2.148548496 0.434040304
2 139 1 1.801373099 0.080430585 2.092864909
3 15 1 -0.504148447 1.158435425 0.771048924
4 1 1 -0.686471459 0.355961741 -0.145750225
5 7 1 -0.820546857 0.442175622 1.825474402
6 11 1 0.268240074 0.802493407 0.080893178
7 0 1 -0.493636867 0.375293153 0.573253225
8 8 1 0.72767749 0.070195021 -0.228101346
9 23 1 0.527134111 1.196801133 0.589503425
10 5 1 -1.540530272 1.619615831 1.071691351
11 200 1 0.934676218 1.012937027 2.408493739
12 321 1 1.613109628 1.395561261 1.772718184
13 86 1 -0.665947638 2.601282293 1.476294195
14 0 1 2.58609672 0.070249734 1.204037005
15 75 1 1.633343397 0.058584787 1.501908833
16 4117 1 2.158476338 2.344014304 2.809786812
17 13 1 1.639288732 0.140851515 0.190201761
18 10 1 -0.26405467 0.915985131 0.848716353
19 0 1 -0.132223162 1.041922045 1.864684555
20 4 1 0.284495636 0.100280935 0.238173281
21 0 1 -0.07853971 2.345437551 -0.133841944
22 1543 1 2.815858844 1.584458271 1.939240632
23 106 1 1.815947006 1.204528823 0.510764623
24 6 1 -0.919935918 1.01288542 1.441913079
25 0 1 1.600916988 0.987582435 0.001774726
26 74 1 -0.805464711 0.700728191 3.417625719
27 40 1 1.158006518 0.318182064 1.247635988
28 0 1 1.832724378 1.880785968 0.382622566
29 0 1 0.669880454 0.038102551 0.630297368
30 241 1 1.041165514 1.682074495 1.799590357
31 5 1 1.826781029 -1.936939901 0.954953194
32 45 1 1.298312616 0.588530186 0.835506127
33 952 1 1.205678291 1.122062448 3.524682698
34 2 1 -0.248608134 0.25198281 0.913111879
35 109 1 3.102556754 1.124687414 -0.416833253
36 213 1 1.01369739 1.218032003 2.181664059
37 0 1 0.491717946 2.686430712 1.264299687
38 57 1 1.538281573 1.640759419 -0.388871051
39 76 1 0.831307714 1.110495127 1.505124911
40 29 1 0.10000232 2.629723576 -0.495964427
41 0 1 2.237064622 1.201867297 0.516706244
42 2 1 -1.028786768 0.330159096 0.191258677
43 20 1 -0.138692937 1.364370033 0.618534677
44 90 1 1.933672104 1.591918153 -0.197365162
45 0 1 0.492817929 -0.719812154 0.019198246
46 13 1 0.172185728 1.240199677 0.417637589
47 19 1 0.285813009 0.590229573 1.419569923
48 1 1 -0.820661872 -0.38471966 1.124148233
49 26 1 1.394492725 -0.268906917 1.041842922
50 107 1 1.998495218 1.093543328 0.665449117
51 1053 1 0.979190049 2.444203043 2.490915015
52 21 1 1.874292524 0.098065975 0.254254291
53 31 1 1.226109818 0.527391491 0.644971437
54 0 1 2.356911517 0.775583104 1.859593196
55 155 1 2.299232416 2.500828472 -0.728587176
56 65 1 1.217483374 1.481188675 0.497854519
57 26 1 1.48400698 -0.815609677 1.300043223
58 0 1 2.48713067 0.90949837 0.831035604
59 0 1 1.315560455 0.150026561 0.493335813
60 4 1 -0.644685681 1.105909031 -0.442400788
61 534 1 2.321458044 1.370274483 1.559825769
62 13 1 -0.460574532 -0.198342202 2.275644021
63 280 1 1.62745939 2.096186064 0.907013322
64 1 1 -1.462302942 0.131325555 0.808617873
65 60 1 2.628936719 0.134406434 0.446405554
66 32 1 1.294384341 1.18273574 -0.231874576
67 14 1 0.08413495 1.949344126 -0.382151923
68 87 1 -0.411609242 1.708463382 2.053365065
69 3 1 -0.554934502 -0.167479704 -0.131514797
70 0 1 -1.101663245 0.935372333 -0.86894494
71 12 1 0.189842914 2.21741084 -0.788981857
72 0 1 0.740625863 0.794476382 0.71140164
73 0 1 1.715290086 2.143801108 0.816039282
74 0 1 1.252572723 3.022170235 -0.004890403
75 25 1 -0.373922989 0.056760082 2.416334131
76 11 1 1.411277797 -0.3071286 -0.076262558
77 260 1 1.058433007 1.960420741 1.494615753
78 10 1 1.04273236 -0.236274723 0.332190734
79 0 1 1.582046761 1.135317898 0.595587385
80 56 1 1.852239065 0.420771426 0.84740689
81 0 1 -0.095761603 1.702980397 0.906572762
82 0 1 -1.484126124 0.724602174 0.52956048
83 53 1 0.728951443 1.151280293 1.008606828
84 71 1 1.024409437 1.374301981 0.687993842
85 0 1 -1.01518042 0.054318734 1.487828812
86 0 1 -0.172992781 -0.617774526 1.395822374
87 95 1 2.354415617 1.134775138 -0.130221596
88 232 1 3.598660247 1.893259548 -1.095419869
89 16 1 1.708743348 0.830808035 -0.805728862
90 31 1 0.8056603 0.862692183 0.856548543
91 98 1 0.854586785 2.390460476 0.312085051
92 485 1 1.769052428 3.404715908 0.057472015
93 320 1 1.111846819 2.209737982 1.589324759
94 0 1 0.984481251 1.121123717 0.749495271
95 3178 1 2.563733829 2.468397009 2.013996089
96 61 1 2.15334645 0.178267871 0.843308478
97 0 1 -0.127117911 0.564778856 0.038863895
98 182 1 0.905156631 0.819153039 2.571524279
99 60 1 1.390395848 1.56900858 0.487291816
100 3166 1 2.355217089 1.50671147 3.209739736
1 43 2 0.06155278 2.148548496 0.434040304
2 145 2 1.801373099 0.080430585 2.092864909
3 12 2 -0.504148447 1.158435425 0.771048924
4 0 2 -0.686471459 0.355961741 -0.145750225
5 13 2 -0.820546857 0.442175622 1.825474402
6 9 2 0.268240074 0.802493407 0.080893178
7 0 2 -0.493636867 0.375293153 0.573253225
8 5 2 0.72767749 0.070195021 -0.228101346
9 32 2 0.527134111 1.196801133 0.589503425
10 10 2 -1.540530272 1.619615831 1.071691351
11 195 2 0.934676218 1.012937027 2.408493739
12 321 2 1.613109628 1.395561261 1.772718184
13 90 2 -0.665947638 2.601282293 1.476294195
14 0 2 2.58609672 0.070249734 1.204037005
15 62 2 1.633343397 0.058584787 1.501908833
16 4019 2 2.158476338 2.344014304 2.809786812
17 20 2 1.639288732 0.140851515 0.190201761
18 12 2 -0.26405467 0.915985131 0.848716353
19 0 2 -0.132223162 1.041922045 1.864684555
20 7 2 0.284495636 0.100280935 0.238173281
21 0 2 -0.07853971 2.345437551 -0.133841944
22 1569 2 2.815858844 1.584458271 1.939240632
23 94 2 1.815947006 1.204528823 0.510764623
24 15 2 -0.919935918 1.01288542 1.441913079
25 0 2 1.600916988 0.987582435 0.001774726
26 74 2 -0.805464711 0.700728191 3.417625719
27 43 2 1.158006518 0.318182064 1.247635988
28 0 2 1.832724378 1.880785968 0.382622566
29 0 2 0.669880454 0.038102551 0.630297368
30 259 2 1.041165514 1.682074495 1.799590357
31 7 2 1.826781029 -1.936939901 0.954953194
32 43 2 1.298312616 0.588530186 0.835506127
33 934 2 1.205678291 1.122062448 3.524682698
34 5 2 -0.248608134 0.25198281 0.913111879
35 115 2 3.102556754 1.124687414 -0.416833253
36 228 2 1.01369739 1.218032003 2.181664059
37 0 2 0.491717946 2.686430712 1.264299687
38 52 2 1.538281573 1.640759419 -0.388871051
39 95 2 0.831307714 1.110495127 1.505124911
40 28 2 0.10000232 2.629723576 -0.495964427
41 0 2 2.237064622 1.201867297 0.516706244
42 1 2 -1.028786768 0.330159096 0.191258677
43 19 2 -0.138692937 1.364370033 0.618534677
44 84 2 1.933672104 1.591918153 -0.197365162
45 0 2 0.492817929 -0.719812154 0.019198246
46 14 2 0.172185728 1.240199677 0.417637589
47 30 2 0.285813009 0.590229573 1.419569923
48 1 2 -0.820661872 -0.38471966 1.124148233
49 24 2 1.394492725 -0.268906917 1.041842922
50 132 2 1.998495218 1.093543328 0.665449117
51 965 2 0.979190049 2.444203043 2.490915015
52 21 2 1.874292524 0.098065975 0.254254291
53 36 2 1.226109818 0.527391491 0.644971437
54 0 2 2.356911517 0.775583104 1.859593196
55 173 2 2.299232416 2.500828472 -0.728587176
56 81 2 1.217483374 1.481188675 0.497854519
57 19 2 1.48400698 -0.815609677 1.300043223
58 0 2 2.48713067 0.90949837 0.831035604
59 0 2 1.315560455 0.150026561 0.493335813
60 2 2 -0.644685681 1.105909031 -0.442400788
61 506 2 2.321458044 1.370274483 1.559825769
62 14 2 -0.460574532 -0.198342202 2.275644021
63 259 2 1.62745939 2.096186064 0.907013322
64 0 2 -1.462302942 0.131325555 0.808617873
65 75 2 2.628936719 0.134406434 0.446405554
66 29 2 1.294384341 1.18273574 -0.231874576
67 15 2 0.08413495 1.949344126 -0.382151923
68 87 2 -0.411609242 1.708463382 2.053365065
69 0 2 -0.554934502 -0.167479704 -0.131514797
70 0 2 -1.101663245 0.935372333 -0.86894494
71 10 2 0.189842914 2.21741084 -0.788981857
72 0 2 0.740625863 0.794476382 0.71140164
73 0 2 1.715290086 2.143801108 0.816039282
74 0 2 1.252572723 3.022170235 -0.004890403
75 25 2 -0.373922989 0.056760082 2.416334131
76 11 2 1.411277797 -0.3071286 -0.076262558
77 242 2 1.058433007 1.960420741 1.494615753
78 8 2 1.04273236 -0.236274723 0.332190734
79 0 2 1.582046761 1.135317898 0.595587385
80 63 2 1.852239065 0.420771426 0.84740689
81 0 2 -0.095761603 1.702980397 0.906572762
82 0 2 -1.484126124 0.724602174 0.52956048
83 65 2 0.728951443 1.151280293 1.008606828
84 53 2 1.024409437 1.374301981 0.687993842
85 9 2 -1.01518042 0.054318734 1.487828812
86 0 2 -0.172992781 -0.617774526 1.395822374
87 70 2 2.354415617 1.134775138 -0.130221596
88 203 2 3.598660247 1.893259548 -1.095419869
89 13 2 1.708743348 0.830808035 -0.805728862
90 29 2 0.8056603 0.862692183 0.856548543
91 94 2 0.854586785 2.390460476 0.312085051
92 500 2 1.769052428 3.404715908 0.057472015
93 389 2 1.111846819 2.209737982 1.589324759
94 0 2 0.984481251 1.121123717 0.749495271
95 3066 2 2.563733829 2.468397009 2.013996089
96 72 2 2.15334645 0.178267871 0.843308478
97 0 2 -0.127117911 0.564778856 0.038863895
98 188 2 0.905156631 0.819153039 2.571524279
99 83 2 1.390395848 1.56900858 0.487291816
100 3220 2 2.355217089 1.50671147 3.209739736
;
run;
The macro is used to fit the above data set to estimate the parameter value and its corresponding asymptotic variances. The following statements should be used:
filename GEEZIP URL "http://www.ctspedia.org/wiki/pub/CTSpedia/StatToolsTopic051/Rochester_GEEZIP.sas";
%include GEEZIP;
%GEEZIP(DSName=mydata,
Outcome=count,
PredictNum=x1 x2 x3,
ID=id,
Time=time,
OutForm=);
The output generated from these statements are the parameter estimate theta and the asymptotic standard deviation sigma:
theta=(-1.25, 0.81, 1.07, 1.03, 10.7)
sigma=(0.24, 0.14, 0.06, 0.07, 0.05)