MODELING ZERO INFLATED COUNT DATA by CHERYL ELLEN GARDEN B.Comm., University of British Columbia, 1992 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE in THE FACULTY OF GRADUATE STUDIES (Department of Statistics) We accept this thesis as conforming to the required standard THE UNIVERSITY OF BRITISH COLUMBIA April 1996 © Cheryl Ellen Garden, 1996 In presenting this thesis in partial fulfilment of the requirements for an advanced degree at the University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the head of my department or by his or her representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission. Department of The University of British Columbia Vancouver, Canada Date April 25\ m £ DE-6 (2/88) Abstract A natural approach to analyzing the effect of covariates on a count response variable is to use a Poisson regression model. A complication is that the counts are often more variable than can be explained by a Poisson model. This problem, referred to as overdispersion, has received a great deal of attention in recent literature and a number of variations on the Poisson regression model have been developed. As such, statistical consultants are faced with the difficult task of identifying which of these alternative models is best suited to their particular application. In this thesis, two applications where the data exhibit overdispersion are investigated. In the first application, two treatments for chronic urinary tract infections are compared. The response variable represents the number of resistant strains of bacteria cultured from rectal swabs. In the second application, the number of units sold of a product are modeled as depending on two factors representing the day of the week and the store. Two alternative models that allow for overdispersion are used in both applications. The negative binomial regression model and the zero inflated Poisson regression model so named by Lambert (Lambert, 1992) provide improved fits. Further, the zero inflated Poisson regression model performs particularly well in the situation when the overdispersion is suspected to be due to a large number of zeroes occurring in the data. The zero inflated Poisson regression model allows one to both fit the data well and make some inference regarding the nature of the overdispersion present. This little known model may prove to be valuable as there exist a ' number of applications where observed overdispersion in a count response variable is clearly due to an inflated number of zeroes. Table of Contents Abstract i i Table of Contents i i i List of Tables v List of Figures vii Acknowledgement viii 1 Introduction 1 2 Motivating Application and Initial Data Analyses 6 2.1 General Approach 6 2.1.1 Testing for Overdispersion 6 2.1.2 Testing for Zero Inflation 7 2.2 Application 1: A Clinical Trial Comparing Two Treatments for Chronic Urinary Tract Infections 9 2.2.1 Description of Data Set 9 2.2.2 Exploratory Analysis 11 2.2.3 Preliminary Models and Fits 21 2.3 Application 2: Sales in a Retail Environment 27 2.3.1 Description of Data Set 27 2.3.2 Exploratory Analysis 28 2.3.3 Preliminary Models and Fits 40 in 3 Random Effect Model - Negative Binomial 45 3.1 Methodology 45 3.2 Application 1: Results and Discussion 47 3.3 Application 2: Results and Discussion 54 4 Zero Inflated Poisson Regression Model 58 4.1 Methodology 58 4.2 Application 1: Results and Discussion 60 4.3 Application 2: Results and Discussion 67 5 Discussion and Suggestions for Further Study 72 Bibliography 76 Appendix 78 iv List of Tables 1. Frequencies of NSB resistant, emergent resistant, and combined at time 1 14 2. Frequencies of NSB resistant, emergent resistant, and combined at time 2 14 3. Summary of results of Poisson regression models for NSB at time 1 21 4. Summary of results of Poisson regression models for NSB at time 2 24 5. Comparison of observed and expected number of patients with NSB equal zero 26 6. Estimated model parameters for Poisson regression models of NSB at time 2 27 7. Average units sold by day of the week and store 37 8. Comparison of the actual number of days with zero units sold with the number expected under the Poisson model 41 9. Summary of estimated model parameter for Poisson model of units sold 43 10. Annual sales by store 44 11. Summary of fits for NB regression models for NSB resistant at time 2 48 12. Observed and expected frequencies for NSB resistant, N B regression model 50 13. Summary of fits, N B regression models for NSB emergent resistant at time 2 50 14. Observed and expected frequencies for NSB emergent resistant, N B regression model 52 15. A summary of fits of N B regression models for NSB combined at time 2 52 16. Observed and expected frequencies for NSB combined, N B regression model 54 17. Estimated model parameters and standard errors for the N B regression model for the units sold 56 v 18. Observed and expected number of days with zero units sold, N B regression model 57 19. Log-likelihood based on ZIP regression models for NSB resistant 61 20. Observed and expected frequencies for NSB resistant, ZIP regression model 63 21. Log-likelihood based on ZIP regression models for NSB emergent resistant 64 22. Observed and expected frequencies for NSB emergent resistant, ZIP regression model 65 23. Log-likelihood based on ZIP regression models for NSB combined 66 24. Observed and expected frequencies for NSB combined, ZIP regression model 67 25. Log-likelihood for ZIP regression models for the daily units sold 68 26. Estimated model parameters, ZIP regression model for units sold 70 27. Observed and expected number of days with zero units sold, ZIP regression model 71 28. Model performance comparison 73 vi List of Figures 1. Comparison of NSB resistant, emergent resistant, and combined in group A and group B 12 2. Comparison of histogram for NSB resistant with the Poisson distribution 17 3. Comparison of histogram for NSB emergent resistant with the Poisson distribution 18 4. Comparison of histogram for NSB combined with the Poisson distribution 19 5. Time 2 versus time 1 plots for NSB resistant, emergent resistant and combined 20 6. Time series plots of units sold by store 30 7. Auto correlation functions for the units sold in each of the 21 stores 33 8. Units sold by day of the week 38 9. Units sold by store 39 vn Acknowledgement The advice and encouragement of a number of people helped me in the preparation of this thesis. I would like to thank my thesis supervisor, Professor Martin Puterman, for his many years of support and encouragement and for opening my eyes to the study of statistics. His advice and encouragement were much appreciated. I would also like to thank Professor Harry Joe for his helpful comments on improving the manuscript and for his advice and assistance in the later stages of model fitting. In addition, I would like to thank my friend and fellow graduate student, Sonia Mazzi for her words of advice that helped me to focus on completing the work. Also to my close friend and partner, Todd Shea, for listening to my thinking out loud and tolerating my domination of the computer. viii 1 1 Introduction When analyzing the effects of covariates on a non-normal response variable, generalized linear models (GLM's) provide an invaluable tool. More specifically, Poisson regression allows one to analyze the effect of covariates on a count response variable. Frequently, however, observed count data are more dispersed than what is expected under a Poisson distribution. That is, conditioned on the covariates, the variance exceeds the mean. This problem, referred to as overdispersion, arises in many applications and has received a great deal of attention in recent literature (Breslow, 1990, Breslow and Clayton, 1993, Dean and Lawless, 1989). Several adaptations to the basic methodology of G L M ' s have been developed so that there are now several modifications to Poisson regression which allow for overdispersion (Lambert, 1992, Lawless, 1987, Wang, Puterman, Cockburn, Le, 1996). Consequently, statistical consultants are faced with the difficult task of identifying which approach is most appropriate for their particular situation. It is the purpose of this thesis to provide some insights into this issue. The extra variation that frequently arises in count data can often have a physical explanation. When one wishes to model such data it is important to take into consideration these possible physical explanations and incorporate them into the model used. Thus in comparing competing models one should compare them with regard to the inferences made possible by the model as well as with regard to how sensible they are in light of this information. Many features of data may give rise to the overdispersion. When the response is a count for different subjects, overdispersion is particularly common, and is usually considered to be caused by individual random effects. 2 Wedderburn first proposed a method to deal with this problem referred to as quasi-likelihood (Wedderburn, 1974). With the quasi-likelihood method one need only specify the form of the first and second moments rather than the exact distribution of the data. In this way, one is not restricted, as in Poisson regression, to the case of mean, variance equality. Instead, the method assumes that the mean, variance relationship is given by, Var(Y) = a2E(Y) where a 2 is referred to as the dispersion parameter. Applying this methodology to investigating the effects of covariates, one specifies that \og(E(Y)) = x r p where x represents a vector of covariates and P represents a vector of corresponding coefficients or the model parameters. Estimating or quasi-likelihood equations are obtained by minimizing a weighted sum of squared deviations of the data from the values specified by the model (McCullagh and Nelder, 1983), whereas in Poisson regression, the estimating equations are obtained by maximizing the log-likelihood. When making inferences regarding the effects of the covariates, the estimated standard errors for the parameters are multiplied by the square root of the dispersion parameter or its estimate. When the dispersion parameter is quite large, the effects of the covariates may be not be detectable. The quasi-likelihood method treats the extra variation as a nuisance parameter interfering with inference and does not allow any inference regarding the nature of the overdispersion to be made. Random effect, or mixture models have more recently been used to account for this extra variation (Jansen, 1993, Stein, 1988). The overdispersion is again considered a nuisance parameter, however in this case the nuisance parameter represents the subject to subject variation. These models are essentially mixture models where the response conditioned on the mean is assumed Poisson but the mean is random and follows some distribution. A gamma 3 distribution is often the choice for the distribution of the Poisson mean, resulting in the negative binomial distribution for the unconditional response. Other choices for the distribution of the Poisson mean appearing in recent literature are the log-normal (Aitchison and Ho, 1989), and the inverse Gaussian (Dean and Lawless, 1989). Overdispersion may also be the result of the data coming from two or more distinct but unobserved populations each with the observed counts from Poisson distributions with distinct means dependent upon a vector of covariates (Wang, Puterman, Cockburn, Le, 1996). A specific case occurs when the overdispersion may be due to the existence of an unobserved population with strictly zero counts and another with counts following a Poisson distribution with a positive mean. This type of data has been examined by Lambert (Lambert, 1992) as well as by Wang, Puterman, Cockburn, and Le (Wang, Puterman, Cockburn, Le, 1996). In Lambert's paper the counts represent the number of defects in a printed circuit board. A large number of these boards have zero defects, more than can be explained by a Poisson model, and other boards have a positive number of defects. Lambert describes the boards as either being in a perfect state, in which there will be zero defects, or an imperfect state, in which there may be some defects. She refers to this type of Poisson mixture model as a zero inflated Poisson model or a ZIP model (Lambert, 1992). They have the advantage of being simple and reasonable in many situations that share this same structure. Wang, Puterman, Cockburn, and Le use the same general approach to analyze the effect of a number of covariates on the daily seizure frequency in epileptic children. ZIP models are really a specific case of the finite mixture model described by Wang, Puterman, Cockburn, and Le whose model formulation allows for the possibility of more than two unobserved populations with various distinct means. 4 In a situation where there appears to be more zero counts than can be explained by a Poisson distribution, a ZIP model should be considered. The effect of covariates on both the rate of the unobserved non-zero population as well as the probability of an observation arising from the zero population or that the observation is in the zero state can be analyzed. In addition, a score test has been developed by Van Den Broek to detect the presence of zero inflation in Poisson regression (Van Den Broek, 1995). In this thesis I consider two different data sets where the effects of covariates on a count response variable are of interest. In both situations, the counts appear to be overdispersed and there are physical explanations for why this might be so. In chapter two, the data are examined and the inadequacy of an ordinary Poisson regression is demonstrated in the context of initial analyses. In addition, score tests for detecting overdispersion due to individual subject or random effects and due to zero inflation are applied to determine whether or not more complicated models that allow for overdispersion are necessary. In Chapter 3,1 describe the negative binomial regression model and use it to analyze both data sets. The fits are evaluated and all appropriate inferences are made. In Chapter 4,1 describe the ZIP model and use it the analyze both data sets. Again the fits are evaluated and inferences are made where required. Finally in Chapter 5,1 discuss the results of both approaches and make some conclusions and suggestions for further study. This work was motivated by my involvement in the analysis of data from a clinical study. In the study, two different treatments for chronic urinary tract infections (UTI's) in acutely spinal cord injured patients were compared. Chronic UTI is a major cause of morbidity in this unique population (Anderson, 1985) and treatment is controversial. Many infections are asymptomatic and repeated treatment often leads to re-infection with antimicrobial resistant bacteria (Gribble, McCallum and Schechter, 1988). 6 2 Motivating Application and Initial Data Analyses 2.1 General Approach A thorough initial examination of a data set is necessary before a reasonable model can be identified. In this section I investigate both data sets in an effort to understand their basic structure and develop appropriate models that allow for the required inferences. Graphical and numerical summaries facilitate the identification of preliminary models which are fit to the data. These fits are investigated and are shown to be inadequate. The preliminary models are Poisson regression models and with both data sets overdispersion is present. Two score tests based on these models are performed to detect overdispersion. The first test is designed to detect overdispersion that may be modeled by a random effects model and the second test aims to identify if the overdispersion is due to zero inflation. 2.1.1 Testing for Overdispersion Several tests for overdispersion in Poisson regression have been developed in response to the complication of overdispersion. (Cameron and Trivedi, 1990; Dean, 1992; Dean and Lawless, 1989; Ganio and Schafer, 1992) Dean discusses three score tests for testing the null hypothesis that an ordinary Poisson regression model holds against three different alternative models that allow for overdispersion (Dean, 1992). Since, with both data sets, the overdispersion may be explained by random effects, an appropriate adjustment to the Poisson regression model would be the inclusion of a random effect term. The model, 7 (Yj \oXj) ~ Poisson(uA,,), u ~ Gamma(a ,a) £ ( o ) = 1, Var(v) = l/a = a < oo, so that £ ( ] ^ , . £ ( u ) ) = uA, = X.,. = e x ' r p , and VariY;) = EiVariY^ + VariEiY^v)) = E(u)\ +Var(u)Xl = \(\ + a\) has an additional variable, u , representing a multiplicative random effect. Dean and Lawless derived a score test for H 0 : a = 0 (Dean and Lawless, 1989). Under H 0 , the test statistic, is asymptotically standard normal (Dean and Lawless, 1989). Large values of the test statistic indicate the presence of overdispersion. 2.1.2 Testing for Zero Inflation Zero inflated regression models may provide a valuable analysis tool for a number of applications. These models are members of the more general class of models, Poisson mixture models, in which an extra mass at zero is allowed. The proportion of zeroes is allowed to be larger than that expected under a Poisson regression model by adding a positive probability of observation at zero that may or may not depend on a vector of covariates. If one ignores the effect of covariates on the probability that the observation is from the zero group, the extra proportion of zeroes are added as follows (Johnson, Kotz, and Kemp, 1992). v(Yl=o)=P+(\-Py> Pf r = v , > V ^ , , forv,>0 8 Recently, van den Broek developed a score test to test the hypothesis that there are too many zeroes for a Poisson regression to provide an adequate fit for the data (van den Broek, 1995). In order to be perform the test, one must fit a Poisson regression model. The test statistic is then based on comparing the number of zeroes occurring in the data with the number expected under a Poisson regression model taking into account the overall mean of the response variable. The test statistic, denoted 5(P ) is based on the vector of parameter estimates, P from a Poisson regression model. p0j - e Xt', where Xi = eXi p This statistic is asymptotically distributed as a %2\ random variable, so values of S(P ) can be compared with quantiles of the %2\ distribution to test the null hypothesis, H 0 :6 =0 , where 9 = P which is equivalent to the null hypothesis that there are no extra zeroes, ie: p = 0. I-P. Large values of this test statistic indicate the presence of zero inflation. 9 2.2 Application 1: A Clinical Trial Comparing Two Treatments for Chronic Urinary Tract Infections 2.2.1 Description of data set The motivating study was a clinical trial which aimed to compare two different protocols for antimicrobial therapy in the treatment of chronic urinary tract infections (UTI's) 1. The participants in the study were all spinal cord injury patients admitted to Vancouver General Hospital during the period of July 1990 to July 1993. Urinary tract infections are considered by experts to be responsible for a large number of deaths among this unique group of patients as the majority are unable to void spontaneously and must be on intermittent catheterization. (Anderson, 1985; Merrit, 1976; Pearman, 1984). Physicians caring for such patients are faced with a dilemma of when to treat an infection, as symptoms are rarely reported by patients even when an infection is present. There is disagreement as to whether treatment of these asymptomatic infections is beneficial as this often leads to re-infection with antimicrobial resistant bacteria (Gribble, McCallum and Schechter, 1988). A total of 81 patients were recruited to the study; 41 were randomly assigned to treatment group A and the other 40 were assigned to treatment group B. Treatment A might be considered a standard treatment for chronic UTI's in spinal cord injury patients. This treatment consists of administering anti-microbial therapy (oral antibiotics) on every occasion where there is a positive test result for the presence of bacteria in the urine (a positive urine culture). Treatment B is a less standard treatment where patients are only prescribed antibiotics if there is both a positive urine culture and the presence of at least two specific symptoms of bacteriuria. That is, in group B, the 1 This research was conducted at Vancouver General Hospital by Dr. Marie Gribble of the University of British Columbia. 10 patients are only given the antimicrobial therapy if they are "sick". The hypothesis in this study is that the patients in group B will somehow fare better than those in group A. The idea is that having an asymptomatic UTI makes it difficult for other bacteria to take over in the bladder, thus providing some protection against a symptomatic infection. The 81 patients were kept in the hospital and monitored for a period of up to sixteen weeks, however a large number of patients dropped out before the sixteen week period was up. Each week a sample of urine was taken and tested for the presence of bacteria. The presence or absence of bacteria along with variables representing which strain of bacteria and whether or not the particular strain was resistant to certain anti-microbials was recorded. In addition a record of the presence or absence of specific and non-specific symptoms of UTI was maintained as well as a number of variables measured only at the beginning and end of the study. One such variable was a count of the number of different strains of resistant bacteria (NSB) cultured from a rectal swab, and the drugs to which they were resistant. As the frequency of infection with resistant bacteria is of major interest, this work focuses on this last variable as the response and thus the indicator of patient wellness. There are obviously many ways in which one can describe the patients well-being, however, for the purpose of this thesis we will concentrate on only this one measure. The rectal swab data consists of pairs of counts for each of the 81 patients. The counts are further sub-classified into one of two categories; strains resistant to the drugs norfloxacin and cotrimoxazole, and strains with emergent resistance to norfloxacin or cotrimoxazole. A strain is classified as emergent resistant if the infected patient has already been treated with the drug to which the strain has resistance either during or just preceding the study. If we ignore the distinction between resistance and emergent resistance we can consider a combined count of the 11 number of strains with some resistance. We naturally assume that each of the six counts (before and after for each of the three classifications) follow a Poisson distribution. Consequently, a natural first approach to assessing the effect of the treatment group on the number of resistant strains of bacteria (NSB) would be to use Poisson regression with the treatment group as a binary covariate. These data are complicated in two ways however. First, the data appear to show more dispersion than is allowed if it followed a Poisson distribution. Second, the before and after counts may be correlated due to the fact that both counts are from the same patient. 2.2.2 Exploratory Analysis The main interest of this study is to compare the two protocols with respect to NSB at the beginning and end of the sixteen week study period. NSB at the commencement of the study should serve as a baseline measurement. Thus due to the randomization, we expect no difference between the two groups at this time. NSB at the end of the study should somehow be dependent upon the patients' treatment during the study. If the two protocols have different effects we should see a difference between the two study groups. Essentially, how the patients changed from beginning to the end of the study is of interest. The data are summarized in Tables 1 and 2 and Figure 1. 12 Figure 1 Comparison of NSB resistant, emergent resistant and combined in group A and group B. NSB resistant, time 1 NSB resistant, time 2 1 2 r l . r l , 11 n i P . • Group A a Group B NSB NSB emergent resistant, time 1 NSB emergent resistant, time 2 40 w 30 . . .1 2 0 . . § 1 0 . . 0 1 I —M i r - i _ i r~i p 2 3 4 NSB • Group A B Group B • Group A a Group B 13 Figure 1 continued NSB combined, time 1 10 £ 6 1 Q_ 4 . . 2 ..I 0 |l • ,11 ,1 W , L W , L W , L W , L , 1 1 , 1 1 , • Group A • Group B U 0 1 2 3 4 5 6 7 8 9 10 11 N S B NSB combined, time 2 10 = 6 1 .22 T to 4 i i °- 2l\ 0 r i n. XL n n 111 • Group A a Group B • i n | " | W | i M | i W | i W | i M | i M | i W | W | H _ | m | I I | «• 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 N S B 14 Table 1 Frequencies of NSB resistant, emergent resistant and combined at time 1 Resistant Emergent Resistant Combined NSB Group A Group B Group A Group B Group A Group B 0 4 6 33 34 3 5 1 1 1 0 0 1 0 2 7 7 0 0 5 4 3 8 5 1 4 6 6 4 10 7 2 1 9 8 5 6 8 4 0 7 9 6 4 5 1 1 4 6 7 1 1 0 0 1 1 8 0 0 0 0 2 0 9 0 0 0 0 1 0 10 0 0 0 0 1 0 11 0 0 0 0 1 1 Mean 3.415 3.375 0.902 0.550 4.317 3.925 Variance 3.149 4.087 3.590 1.946 6.322 4.943 Table 2 Frequencies of NSB resistant, emergent resistant, combined, at time 2 Resistant Emergent Resistant Combined NSB Group A Group B Group A Group B Group A Group B 0 29 12 12 15 10 6 1 1 2 0 0 0 1 2 2 2 1 0 0 1 3 '3 8 1 4 2 2 4 4 7 10 3 4 5 5 0 6 6 7 5 3 6 0 2 6 5 7 5 7 2 1 4 4 7 3 8 0 0 1 2 5 3 9 0 0 0 0 0 2 10 0 0 0 0 0 3 11 0 0 0 0 0 3 12 0 0 0 0 0 1 13 0 0 0 0 1 0 14 0 0 0 0 0 2 Mean 1.073 2.675 3.585 3.325 4.659 6.000 Variance 3.770 4.584 6.799 8.225 10.030 15.846 15 NSB resistant and NSB emergent resistant do not appear to differ greatly between the two groups at the beginning of the study. NSB resistant appears to differ between the two groups at time 2 with patients in group B having, on average, more than twice as many resistant strains. As a strain is classified as emergent resistant i f the patient has been previously treated with the antimicrobial drug to which the strain has resistance, and since patients in group B were treated less often, it is reasonable that patients in group B would have more resistant strains and fewer emergent resistant strains by the end of the study. NSB emergent resistant at time 2, however, does not appear to differ greatly between the two groups. In summary, it appears that patients in group B tend to get more strains with some resistance to norfloxacin and cotrimoxazole, but fewer of these strains are classified as emergent resistant. We can come to the same conclusions upon inspection of the histograms in Figure 1. Another feature of these data, is that the variance exceeds the mean for almost all of the counts suggesting that a Poisson distribution may not provide a good fit for the data. However, a Poisson regression analysis will be appropriate i f conditioned on the covariates, the mean and variance are similar. For the counts at time one the only covariate identified is the group membership in which case, the overdispersion will still be a concern, however, additional covariates that are only relevant for the counts at time 2 are the number of weeks the patient remained in the study and the NSB count at timel. It appears that overdispersion will be a problem for modeling at least the counts at time one and possibly at time two as well. From Tables 1 and 2 one can also see that the number of patients with NSB equal to zero is particularly high for all three classifications. Perhaps the counts can be modeled as coming from two different Poisson distributions, one with a positive mean and the other with a mean of 16 zero. This would then account for the inflated number of zeroes that are seen. The zero inflation of the counts is better illustrated in Figures 2, 3 and 4 where the histogram for the actual data are compared with simulated data from Poisson distributions with the same means. Figure 2: Comparison of histogram for NSB resistant with the Poisson distribution 17 NSB resistant, timel <M;*J simulated data NSB resistant, time2 simulated data 1 8 Figure 3: Comparison of histogram for NSB emergent resistant with the Poisson distribution -.0f>-NSB emera. resis., timel simulated data ^ • l i l l •HHH| 1 I 1, 1 NSB emerg.resis., time2 •>4 simulated data 19 Figure 4: Comparison of histogram for NSB combined with the Poisson distribution N S B c o m b i n e d , t imel sim u lated data NSB combined, time2 m m BSmsM* U • • simulated data 20 With the possible exception of NSB combined at time 1, the counts do tend to show an inflation in the number of zeroes relative to the number expected under a Poisson distribution. Finally, scatter plots of the counts at time 2 versus the counts at time 1 provided in Figure 5, show that the dependence between counts at time 1 and at time 2 appears to be negligible. As a result a model that ignores this dependence may be reasonable and vastly simplifies the analysis. Figure 5 Time 2 versus time 1 plots for NSB resistant, emergent resistant and combined. N S B resistant, time2 vs t imel 0 5 NSB time 1 N S B combined, time2 vs t imel NSB time 1 N S B emergent resistant, time2 vs t imel 21 2.2.3 Preliminary Models and Fits Although overdispersion is anticipated, reasonable preliminary models for these data are ordinary Poisson regression models. We will model NSB resistant, NSB emergent resistant, and NSB combined at the beginning and the end separately thus concentrating on models for six different univariate responses. The Poisson regression model is specified as follows. (^|x,)~Poissson(A,) so that, £(l^|x,.)= A, and VariY^) = X, (1) ln(A./)= [ij = x / p i = \,2,...,n , where x ; represents a vector of covariates for observation i, and p represents a vector of model parameters. The only covariate available at time 1 is group membership. The analysis essentially simplifies to one of comparing two Poisson means, however, this is easily performed in the context of generalized linear models. In this case, Y) = NSB at time 1 (resistant, emergent resistant or combined) [0 if patient i is in group A ' [1 if patient i is in group B Table 3 Summary of results of Poisson regression models for NSB at time 1. NSB Residual Deviance (G ) d.f Null Deviance PB (p-value) S(P~) (p-value) Resistant 114.0744 79 114.0838 0.24(0.41) 22.65(0.00) Emergent Resistant 207.5104 79 211.0048 16.83(0.00) 115.58(0.00) Combined 130.1418 79 130.8972 2.13(0.02) 33.68(0.00) 22 Upon inspection of the residual deviance in Table 3, the number of resistant strains at time 1 appears to be fit moderately well by the Poisson model however the other two counts are not fit adequately by these models. The effect of group membership appears negligible as the residual deviance is only slightly reduced compared to the null deviance. This is not surprising as we expected to see no significant difference between the two groups at the beginning of the study. A goodness of fit test may be performed by comparing the observed residual deviance with quantiles of the chi-square distribution with the corresponding degrees of freedom (McCullagh and Nelder, 1983). The deviance for Poisson regression has become commonly 2 2 known as G . A poor fit is indicated by a large value for G relative to the degrees of freedom. As can be seen in Table 3 above, the values for G of 114, 207 and 130 for NSB resistant, emergent resistant and combined respectively, on 79 degrees of freedom indicate a poor fit for all three responses. In addition i f we compare the actual number of zero counts observed with that expected under the Poisson model we have further evidence of a lack of fit. For NSB resistant, the model expects about 1 or 2 zero counts among the patients however there are actually 10 patients with zero counts. For NSB emergent resistant the model expects about 16 and 23 zero counts among the patients in group A and B, respectively, but there are 33 patients in group A and 34 in group B with NSB of zero. Finally, for NSB combined, the model expects about 1 zero count among all patients in either group A or B, but there are 3 such patients in group A and 5 in group B. Since the Poisson model implies that the variance equals the mean, larger variances indicate the presence of overdispersion. Under the quasi-likelihood model one can allow for the variance to exceed the mean by assuming Var(Yl\xi) = a 2 \ . A n estimate of a 2 can be obtained by 23 2 X2 z , where (2) a n-p (n-p) n = number of observations, and p = number of covariates in the model (McCullagh and Nelder, 1983). This is the Pearson X2 statistic divided by the residual degrees of freedom. For NSB resistant cF2 = 1.06, for NSB emergent resistant cT2 = 3.53 and for NSB combined o2 = 1.36. This indicates the presence of overdispersion for NSB emergent resistant and possibly also for NSB combined. Upon inspection of the columns PB and S(P), the test statistics described in sections 2.1.1 and 2.1.2 respectively, our two tests for overdispersion also indicate its presence for NSB emergent resistant and combined, they do not however make clear how the overdispersion may have arisen. The overdispersion may be well explained by either a ZIP regression model or a negative binomial model. Our main interest is in determining the effect of the different treatment protocols on NSB however, at the end of the study there are two additional covariates that need to be taken into account, the number of weeks in the study and NSB at time 1 (NSB1). Since not all of the patients remained in the ward for the full sixteen week duration of the study, we feel the effect of the length of time must be considered. In addition, since the longer the patients' are in the ward, the longer they are treated according to regime A or B, the interaction between the group and the number of weeks should also be considered. NSB1 serves as a baseline measure for the patients. The patients do vary considerably with respect to this measure and ignoring this variability would be a mistake. In addition, since we are mainly interested in how the patients have changed, we must take into account this baseline before attributing any effect on NSB at time 2 24 to the treatment. Using NSB1 as a covariate allows one to consider the dependence of the second count on the first as well as allow for differences in baseline measure to be considered. The model as specified in (1) applies with, Yj - NSB at time 2 (resistant, emergent resistant or combined) We will consider the covariates; group membership (grp), number of weeks in the study (weeks), and NSB at the beginning of the study, NSB1 as well as the interaction between weeks and grp. Table 4 Summary of results of Poisson regression models for NSB at time 2 NSB Model Residual Deviance (G 2) df PB (p-value) 5(P) (p-value) Resistant grp* weeks+NSB 1 207.31 76 6.68(0.00) 65.865 (0.00) grp* weeks 208.05 77 6.73(0.00) 65.297 (0.00) grp+weeks+NSBl 209.34 77 6.81(0.00) 67.104 (0.00) grp+weeks 209.82 78 6.86(0.00) 66.105 (0.00) Emergent Resistant grp * weeks+NSB 1 211.78 76 4.48(0.00) 143.173 (0.00) grp* weeks 213.50 77 4.52(0.00) 123.490 (0.00) grp+weeks+NSB 1 211.96 77 4.49(0.00) 155.321 (0.00) grp+weeks 213.57 78 4.52(0.00) 130.412(0.00) Combined grp* weeks+NSB 1 231.03 76 6.76(0.00) 130.394 (0.00) grp* weeks 231.12 77 6.78(0.00) 145.106 (0.00) grp+weeks+NSB 1 231.07 77 6.77(0.00) 131.596 (0.00) grp+weeks 231.17 78 6.79(0.00) 146.674 (0.00) In Table 4, the fits of four models for each of the three classifications of NSB are summarized. For each of the three classifications, four models are fit. The full model considers the covariates, treatment group, weeks in the study, NSB at time 1 and the interaction between the treatment group and the weeks in the study. This model is abbreviated as grp*weeks+NSB 1 in the table. 25 Examining the values of the goodness of fit statistic, G 2 reveals that not even the full model provides an adequate fit to these data. Based on the full models, for NSB resistant our estimated dispersion parameter is cT2 = 2.74, for NSB emergent resistant a2 =2.10 and for NSB combined a 2 =2.50. It appears that overdispersion is present in these data. This is further evidenced by the large values for the two test statistics, PB and S(P) for all models. In addition, there appear to be far too many counts of zero to be adequately explained by a Poisson regression model. Of the patients who remained in the study the entire 16 weeks, the model that includes both covariates, group and weeks as well as the interaction between the two, expects 4 of the 11 patients in group A and 1 of the 18 in group B to have NSB resistant equal to zero when the actual numbers are 8 and 5. For NSB emergent resistant the model expects no zero counts in either of the groups A or B for the 29 patients who remained the entire 16 weeks in the study. The actual number of zero counts were 0 for group A, but 6 for group B. For NSB combined, we again see the evidence of a lack of fit. However, for those patients staying the entire 16 weeks, this time the number of zeroes expected under the model does not differ greatly from that observed indicating that perhaps zero inflation is not a problem and perhaps the overdispersion is better explained by individual random effects, however, this ignores the possibility of zero inflated counts for patients who did not remain in the study for the full sixteen weeks. In Table 5 below, the observed number of patients with NSB equal to zero are compared with the number of patients expected under the model. 26 Table 5 Comparison of observed and expected number of patients with NSB equal zero. (Expected numbers are given in parentheses.) Group A Group B NSB resistant emergent resistant combined resistant emergent resistant combined 1 1(0) 1(0) 1(0) 2(0) 2(1) 2(0) 2 2(1) 3(1) 2(0) 0(0) 1(0) 0(0) 3 0(0) 0(0) 0(0) 0(0) 0(0) 0(0) 4 1(0) 1(0) 1(0) 1(0) 1(0) 1(0) 5 1(1) 1(0) 1(0) 0(0) 0(0) 0(0) 6 1(1) 1(0) 1(0) 1(0) 2(0) 1(0) 7 1(0) 0(0) 0(0) 0(0) 0(0) 0(0) 8 1(0) 0(0) 0(0) 0(0) 0(0) 0(0) 9 1(1) 1(0) 1(0) 0(0) 0(0) 0(0) 10 4(1) 1(0) 1(0) 1(0) 3 (0) 1(0) 11 0(0) 0(0) 0(0) 0(0) 0(0) 0(0) 12 2(1) 1(0) 1(0) 0(0) 0(0) 0(0) 13 1(1) 1(0) 0(0) 0(0) 0(0) 0(0) 14 2(1) 0(0) 0(0) 0(0) 0(0) 0(0) 15 3(1) 1(0) 1(0) 2(0) 0(0) 0(0) 16 8 (4) 0(0) 0(0) 5(1) 6(0) 1(0) The model appears to consistently underestimate the number of patients that have NSB equal to zero. It is not clear, however, from inspection of the two test statistics, 5(P ) and PB, whether a random effect model or a ZIP model would better explain the observed overdispersion as both statistics have small p-values. The model parameters estimated under the full model along with their standard errors corrected for overdispersion and a t-value are summarized below in Table 6. 27 Table 6 Estimated model parameters for Poisson regression models of NSB at time 2. NSB Parameter Parameter Standard t-Estimate Error value Resistant interaction(group:week) 0.0530635 0.0614822 0.863 group 0.32692938 0.7267554 0.450 week -0.03415314 0.0533424 -0.640 NSB1 0.03941149 0.0759832 0.519 Emergent interaction(group: week) -0.012603994 0.0422624 -0.298 Resistant group -0.001734265 0.5749374 -0.003 week 0.08687913 0.0289098 3.005 NSB1 0.046401763 0.0500387 0.927 Combined interaction(group:week) -0.004443031 0.0342365 -0.130 group 0.240052530 0.4497721 0.534 week 0.055320357 0.0259616 2.131 NSB1 -0.006739101 0.0352619 -0.191 Few of the covariates appear to have a significant effect on NSB upon inspection of the t-values. It does appear that the covariate representing the number of weeks the patients remained in the study may have a significant effect on NSB emergent resistant and perhaps NSB combined. Any further inference is left until a model that accounts for the apparent overdispersion is fit as the overdispersion may be disguising other effects. 2.3 Application 2: Sales in a Retail Environment 2.3.1 Description of Data Set The second data set considered was obtained from a study undertaken at the initiative of a large retail hardware chain, Canadian Tire Pacific Associates. The data consist of daily sales of one of many products sold by the chain, at the 21 stores owned and operated in the lower mainland. Sales were monitored from October 9, 1992 until August 18, 1993 for a period of 314 28 consecutive days. Sales are recorded as the number of units sold and as such are discrete count data. The initial goal of the study was to use the data in an effort to develop an optimal inventory control policy. This was the topic of a MSc. thesis written by Kapalka while a student at the University of British Columbia in the faculty of commerce (Kapalka, Katircioglu and Puterman, 1995). Customer demand for the product varies from day to day and must be accounted for in the model. It was noted in the initial study that no theoretical distribution was sufficient for describing the demand of products having medium demand. A model for the daily demand is required and is the focus of this analysis. The model will investigate the effect of two factors, the day of the week and the store location. A natural first approach to modeling the daily units sold is to use the Poisson regression model. Again, however, the data are somewhat complicated. The possibility of serial correlation between the daily units sold must be examined. In addition, on many days zero units of the product are sold whereas on other days some positive number of units are sold. The units sold do exhibit some overdispersion relative to the Poisson model which needs to be taken into account. This overdispersion may be explained by either individual random effects associated with the particular day or by a model that allows for zero inflated counts. 2.3.2 Exploratory Analysis The units sold in each of the 21 stores was collected on a series of 314 days, from October 9, 1992 until August 18, 1993. Time series plot for each of the 21 stores are provided in Figure 6. No obvious trend can be identified from inspection of these plots for any of the 21 stores. Demand for this particular product appears not to be affected by seasonality. The presence of serial correlation between the daily observations would necessitate a considerably more complex model. Serial correlation is, however, not a concern here as an initial examination of the autocorrelation functions rules out this complication. The autocorrelation functions for the each of the twenty-one series of observations are shown below in Figure 7. None of the lags show significant dependence between the observations. This vastly simplifies the subsequent analysis. Figure 6 Time series plots of units sold by store. Store 1 Store 2 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 3 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 5 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 7 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 4 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 6 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 8 JL. mUJm LillJ II Jut JUL 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Figure 6 continued Store 9 Store 10 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 11 iiMjriLJ ILll 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 13 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 12 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 14 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 15 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 16 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Figure 6 continued Store 17 Store 18 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 19 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Store 20 AJUIJ AL 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Time in days Store 21 10/09/92 12/10/92 02/10/93 04/13/93 06/14/93 08/15/93 Time in days Figure 7 Auto correlation functions for the units sold in each of the 21 stores. Series : Storel Series : Store2 < 10 15 Lag Series : Store3 < Lag Series : Store4 < 1- -i - , - i - r I- r ~ -i - -Lag Series : Store5 < Lag Series : Store6 20 < 10 15 20 Lag Series : Store7 < 10 15 Lag Series : Store8 20 < 10 15 Lag < 10 15 Lag Figure 7 continued Series : Store9 Series : Store 10 CD < 1 1 CD < o , , 1 1 1 . . . o , - 1 1 . , 1 . . 1 I I 1 1 '1 . J I 0 5 10 15 20 0 5 10 15 20 Lag Lag Series : Store11 Series : Store12 CD fcd < 1 CD fed < o [ ' ' 1 ' ' ' - r - 1 1 1 1 U 1 ' ' ' ' O ' 1 1 I . . ' 1 ' 1 • i j 1 — c 1 r — 0 5 10 15 20 0 5 10 15 20 Lag Lag Series: Store 13 Series: Store 14 CO fcd < CO &d < i i . , r o - I . I 1 1 I 1 1 1 1 J 1 1 0 5 10 15 20 0 5 10 15 20 Lag Lag Series : Store 15 Series : Store16 CD < CO fcd < o ••t • • i . o ' T _ i L . ... ' .. . . I 1 I I ... 1 1 J 0 5 10 15 20 0 5 10 15 20 Lag Lag Figure 7 continued Series : Store17 Series : Store18 < - i _ i i . 10 15 Lag Series : Store 19 10 15 Lag Series : Store20 20 < 10 15 Lag Series : Store21 20 < 10 15 Lag < Lag Our primary interest in analyzing these data is to determine i f we can better model the units sold knowing at which store and on which day the observation was made. In Table 7 the mean units sold for each day of the week and each of the 21 stores are summarized. The variances are given in parentheses. From inspection of Table 7, one notes that, on average, more units are sold on Saturdays than any other day of the week and more in general on weekends than on weekdays. This trend is consistent across most of the 21 stores. In addition, one can also see that the stores tend to vary considerably with respect to the number of units sold on any particular day. Together both of these factors appear to be important in determining the number of units sold. One can also note that the majority of the variances, given in parentheses, of the units sold by day of the week and store exceed the mean. This indicates that overdispersion may be a problem even after the two factors have been taken into consideration. The number of units sold for each day of the week over all 21 stores are summarized in histograms in Figure 8 below. Also, for each of the 21 stores histograms of the number of units sold over all days are provided in Figure 9. In all of the histograms a large number of observations of zero units sold are evident. The overdispersion present in this data may be due to the presence of zero inflation. More simply put, the overdispersion could be due to the fact that on many days zero units are sold whereas on the days when purchases are made, a number of units are sold, which suggests a compound Poisson model for these data. 37 Table 7 Average units sold by day of the week and store Monday Tuesday Wednesday Thursday Friday Saturday Sunday All Days 1 0.55 0.53 0.31 0.66 0.69 0.77 0.51 0.58 (0.53) (1.03) (0.99) (0.83) (1.04) (0.95) (0.53) (0.85) 2 0.40 0.40 0.55 0.41 0.31 0.75 0.55 0.48 (0.56) (0.52) (0.80) (0.53) (0.27) (0.78) (0.66) (0.60) 3 0.84 1.00 1.22 1.34 1.20 1.18 1.38 1.17 (0.82) (1.41) (1.81) (2.37) (1.62) (1.87) (2.06) (1.70) 4 1.13 1.02 1.04 1.02 0.82 2.22 1.58 1.26 (1.30) (1.29) (1.91) (1.46) (0.97) (3.27) (3.52) (2.12) 5 0.62 0.60 0.62 0.48 0.49 0.69 0.60 0.59 (0.60) (1.29) (1.10) (0.39) (0.57) (1.08) (0.65) (0.81) 6 0.78 0.53 0.58 0.86 0.60 0.55 0.71 0.66 (2.68) (0.75) (0.57) (1.56) (2.47) (0.71) (0.98) (1.38) 7 0.98 1.11 1.02 1.16 1.33 1.24 1.38 1.18 (1.84) (1.70) (2.11) (2.09) (2.36) (2.14) (2.10) (2.03) 8 0.38 0.62 0.47 0.18 0.69 0.53 0.24 0.45 (0.60) (0.97) (0.80) (0.43) (1.40) (0.75) (0.28) (0.77) 9 1.00 0.96 0.58 1.05 0.84 0.95 0.80 0.88 (1.13) (1.18) (0.98) (2.14) (1.95) (0.95) (0.57) (1.27) 10 0.91 0.84 0.84 0.68 0.67 1.00 0.78 0.82 (0.99) (1.04) (0.95) (0.83) (1.09) (1.09) (0.81) (0.97) 11 0.29 0.44 0.44 0.39 0.60 0.62 0.40 0.46 (0.39) (0.66) (0.53) (0.34) (1.61) (0.56) (0.61) (0.67) 12 1.00 0.76 1.18 0.70 0.96 1.27 1.04 0.99 (1.41) ( i .o i ) (1.56) (0.59) (1.63) (2.84) (1.23) (1.48) 13 0.87 0.51 0.69 0.36 0.53 0.58 0.58 0.59 (1.21) (0.66) (0.95) (0.47) (0.62) (0.57) (0.98) (0.79) 14 1.20 0.89 0.73 0.89 0.78 1.13 1.16 0.97 (1.98) (0.79) (1.06) (0.94) (1.18) (1.71) (1.95) (1.38) 15 0.51 0.69 1.02 0.84 0.82 1.07 0.89 0.83 (0.53) (0.86) (2.07) (1.40) (1.56) (1.88) (0.83) (1.31) 16 0.47 0.38 0.42 0.45 0.62 0.78 0.69 0.55 (0.53) (0.74) (0.48) (0.49) (0.79) (0.90) (0.86) (0.69) 17 0.76 0.58 0.53 0.75 0.73 0.95 0.98 0.75 (0.87) (0.75) (0.71) (2.66) (1.02) (1.23) (1.84) (1.29) 18 0.78 0.82 0.71 0.70 1.02 1.44 1.76 1.04 (1.09) (1.01) (1.21) (0.82) (1.61) (2.93) (2.42) (1.70) 19 0.73 0.31 0.56 0.68 0.58 0.71 0.38 0.56 (1.29) (0.36) (0.66) (1.34) (0.70) (0.85) (0.38) (0.80) 20 0.73 0.58 0.47 0.66 0.47 0.62 0.58 0.59 (2.61) (0.98) (0.44) (0.83) (0.48) (0.97) (0.98) (1.03) 21 0.89 0.71 0.91 0.68 0.53 0.69 1.07 0.78 (1.01) (0.76) (1.58) (0.83) (0.62) (0.99) (1.65) (1.07) All Stores 0.75 0.68 0.71 0.71 0.73 0.94 0.86 (1.18) (0.97) (1.15) (1.16) (1.25) (1.50) (1.37) Figure 8 Units sold by day of the week Mrdsys TiesdayS V\fecrE9d^ s 0 2 4 6 8 10 0 2 4 6 8 10 0 2 4 6 8 10 irits irits Lrits Trirsc^s Fhcbys Sauries 0 2 4 6 8 10 irits Figure 9 Units sold by store 0 2 4 6 units 40 2.3.3 Preliminary Models and Fits A natural first approach to modeling these data is to use Poisson regression. We will model the number of units sold on any particular day as depending on the two factors we have at our disposal, store and day of the week.. The model is specified as follows. ( ^ O - P o i s s o n f ^ , ) so that E(Y{j[k^ = \. , and Var(Yl}\\t) = \. ln(\ .) =ct + p, +yj , z = l,...,21 and j = 1,...,7 represents the effect of store i on the units sold and y . represents the effect of the day of the week j. Monday is considered to be day one and store 1 is naturally considered to be store 1. The constraints put on these parameters are such that P, and y, are set to zero. This implies that the other parameters represent the effect of the particular store compared to store 1, or the effect of the particular day of the week compared to Monday. Estimation of the parameters using these constraints are easily obtained with the Splus function glm provided that the constraints are set to treatment constraints prior to fitting the model (Chambers and Hastie, 1992, p. 32). After fitting the model to the data, we find that the residual deviance is relatively large compared to the degrees of freedom which suggests a lack of fit and provides an indication that overdispersion may be present. The residual deviance is 9032.086 on 6567 degrees of freedom. The estimate of the dispersion parameter given by (2) is 1.51 and the two test statistics PB and S{\} ) take on values of 27.68 and 346.54 respectively. It is fairly clear that the Poisson regression model inadequately describes this data. A comparison of the actual number of days with zero units sold with the number expected under the model is provided in Table 8. Upon inspection of Table 8 one can note that for the majority of stores for each day of the week, the model underestimates the number of days when zero units are sold. This suggests that a ZIP model may provide an improved fit by allowing more days with zero sales. Table 8 Comparison of the actual number of days with zero units sold with the number expected under the Poisson regression model. (Expected numbers are given in parentheses) 0 Store Monday Tuesday Wednesday Thursday Friday Saturday Sunday 1 26 (26) 28 (27) 38 (26) 25 (26) 27 (26) 22 (22) 27 (24) 2 33 (28) 31 (29) 29 (29) 32 (28) 32 (28) 23 (25) 28 (26) 3 20 (14) 20 (16) 18 (15) 16(15) 18 (15) 17(11) 13 (12) 4 14(13) 17(15) 20(14) 19(14) 23 (14) 7(10) 13(11) 5 24 (26) 31 (27) 29 (26) 26 (26) 29 (26) 25 (22) 26 (23) 6 27 (24) 30 (25) 26 (24) 24 (24) 30 (24) 28 (20) 26 (22) 7 23 (14) 20 (16) 24(15) 20(15) 18 (15) 17(11) 15(12) 8 35 (29) 28 (30) 30 (30) 39 (29) 28 (30) 29 (26) 36 (27) 9 18 (19) 20 (21) 28 (20) 19(19) 26 (20) 18(15) 17(17) 10 20 (20) 23 (22) 19(21) 23 (22) 26 (22) 18(17) 21 (18) 11 35 (29) 31 (30) 20 (30) 29 (29) 31 (29) 23 (26) 32 (27) 12 22(17) 24(19) 16(18) 20(18) 24(18) 24(13) 19(15) 13 21 (25) 28 (27) 26 (26) 32 (26) 28 (26) 26(22) 30 (23) 14 20(17) 17(19) 24(18) 19(18) 25 (18) 20 (14) 17(15) 15 28 (20) 26 (22) 19(21) 22 (20) 25 (20) 22(16) 17(18) 16 29 (26) 33 (18) 31 (27) 28 (27) 27 (27) 22 (23) 27 (24) 17 23 (21) 28 (23) 20 (22) 27 (23) 24 (22) 21 (18) 25(19) 18 24 (16) 21 (18) 27(17) 23(17) 20(17) 17(13) 11(14) 19 25 (27) 33 (27) 29 (27) 26 (26) 27 (26) 23 (23) 30 (24) 20 29 (25) 28 (27) 27 (26) 25 (26) 28 (26) 29 (22) 29 (23) 21 21 (21) 23 (23) 22 (22) 24 (21) 26 (21) 25 (17) 21 (19) The model we use to fit these data uses a fixed effect for both the store and the day of the week factors. Although this makes sense for the day of the week, it implies that these twenty one stores are the only stores of interest. This may not coincide with management's perspective particularly when new stores are built or market conditions change. As an alternative to the 42 factor representing the store, it would be more useful for management i f covariates could be identified that acted as a surrogate for this factor. Our aim is to find a form of model that fits the data well and the inclusion of an effect particular to the store in essence captures many attributes of the store without the required knowledge of what attributes are important in determining the units sold of a particular product. However, new locations will not have sufficient data to be helpful in this respect and additional covariates may be necessary. It is interesting to note that the parameters representing the effect of stores 3, 4 and 7 are similar, so the model predicts that these stores will sell a similar number of units on any particular day. A l l of these stores have sales in excess of $7 million annually, considerably higher annual sales than most other stores. The estimated model parameters together with their standard errors and the annual sales of the 21 locations are summarized in Table 9 and 10. This suggests that covariates such as annual sales may be able to capture the effect of any particular store on the units sold. This is promising for management in that it would enable forecasts of the units sold particular to new or growing stores. If management could identify the attributes of a store that are important in determining how many units of a certain product are sold, the model may be more useful for estimating demand. Unfortunately such additional data were not available at the time of the preparation of this thesis. 43 Table 9 Summary of estimated model parameters for Poisson model of units sold Parameter Parameter Estimate Standard Error intercept -0.5719 0.1005 store 2 -0.1746 0.1348 store 3 0.7041 0.1114 store 4 0.7854 0.1099 store 5 0.0164 0.1282 store 6 0.1343 0.1244 store 7 0.7123 0.111 store 8 -0.2567 0.1375 store 9 0.4255 0.1171 store 10 0.3505 0.1189 store 11 -0.2356 0.1370 store 12 0.5380 0.1146 store 13 0.0218 0.1281 store 14 0.5185 0.1151 store 15 0.3698 0.1184 store 16 -0.0569 0.1307 store 17 0.2696 0.1209 store 18 0.5853 0.1136 store 19 -0.0224 0.1295 store 20 0.0165 0.1281 store 21 0.3068 0.1200 Tuesday -0.1019 0.0667 Wednesday -0.0593 0.0660 Thursday -0.0564 0.0663 Friday -0.0343 0.0655 Saturday 0.2231 0.0616 Sunday 0.1314 0.0630 Table 10 Annual sales by store Store Annual Sales ($) 1 2,901,969 2 4,015,303 3 8,138,673 4 7,307,820 5 4,102,110 6 4,153,736 7 8,175,105 8 3,856,571 9 3,714,372 10 3,532,752 11 2,417,992 12 7,899,398 13 4,647,794 14 3,825,372 15 3,960,262 16 2,705,602 17 4,161,227 18 4,606,817 19 5,855,022 20 3,114,180 21 6,553,310 45 3 Random Effect Model - Negative Binomial 3.1 Methodology When the deviance associated with a Poisson regression model is excessively large one often considers adding a random effect to the model so that the observed overdispersion may be included in the model. A common approach to incorporating random effects into a Poisson regression model is to use a negative binomial regression model (NB regression model) (Jansen, 1993, Stein, 1988). Lawless (Lawless, 1987) describes the negative-binomial regression model and examines its performance. The N B regression model is a member of a more general class known as mixture models. In a Poisson mixture model, one assumes that the count response variable conditioned on the mean follows a Poisson distribution however, one further assumes that the Poisson mean is random and follows some known distribution. When the distribution for the Poisson mean is Gamma, then the marginal distribution for the count response is the negative binomial. The N B regression model is specified below. Let, Yj be the i t h observation of the count response and x, be a vector of covariates. (^|uAj) ~ Poisson(uA,,.), o~Gamma(a,oc) (3) £ ( o ) = 1, Var(y>) = Xi=a<o0> s o t h a t E ( . Y I \ E ( » ) ^ I ) = £ ( U ) ^ = \ = E ^ > A N D Var(Yi) = Xi{l + aXi) The marginal distribution for the count response is determined by integrating over the support of the Gamma distribution with respect to u . That is, Xy,|x,.)= j" x y^y' y , ! r ( a ) This is the probability function of the negative binomial distribution. So (^|x,) « , J / ) . The parameter, j / = a, is referred to as the index or dispersion parameter (Lawless, 1987). Estimates for the parameters in P can be obtained by maximum likelihood and for the parameter, a, by either the method of moments or maximum likelihood. We will focus on maximum likelihood estimation since the maximum likelihood estimator (MLE) is noted to be more efficient than the moment estimator (Lawless, 1987) and the estimation is performed with relative ease. The likelihood function for a vector of n independent observations of the count response is given by, £(p,fl)=n »T(y,+a-')( aX, /=f r ( a - ) y , . ! V1 + aXi j v 1 + akj j Lawless points out that since for any c > 0,T(y + c)/T(c) = c(c +1) • • • (c + y -1), ify is an integer > 1, then the log likelihood, log{Z(P,a)}, can be written as, /(P,a) = X Xlog(l + aj) + y; log(aXi) - (y. +a~l)log(l + aXt) - log(y,.!) 7=0 (4) (Lawless, 1987). Score or estimating equations are given by setting the first derivatives of (4) to zero and M L E ' s are obtained by solving these equations with respect to the parameter sought. Standard errors for the parameter estimates are obtained from the inverse of the Fisher information matrix, 47 since for n large, 4n($ -$,a-a) follows a normal distribution with expectation (0,0) and covariance matrix given by the inverse of the Fisher information matrix. The maximization can be performed by first assuming a fixed value for a and then maximizing with respect to P to obtain the MLE ' s , P , and then use the profile likelihood /(P ,a) to determine the M L E , a . Alternately one may use the statistical software Splus. Ripley and Venables discuss fitting this model using the software S-plus (Ripley and Venables, 1994, p. 200). They also provide the function glm.nb which fits a N B regression model. I used this function to fit N B regression models to both data sets. 3.2 Application 1: Results and Discussion The observations of the number of resistant strains of bacteria were obtained from 81 different patients. It was noted in Section 2.2.2 that there was considerable variability between the counts from different patients at baseline. In addition, even after covariates had been considered a great deal of extra variation remained in the data. The Negative Binomial regression model described above would allow for counts from each patient to follow a Poisson distribution with a random mean. This allows us to consider a random subject effect and allows for overdispersion in the model. The Negative binomial model specified in (3) is applied to this data with Yt = NSB resistant, for patient i at time 2, and x, = a vector of covariates for patient i . The fits for models of NSB resistant are summarized in Table 11. Since each time a new model was fit to these data the dispersion parameter was re-estimated, the residual deviance did not monotonically increase as covariates were dropped from the model. As such we use the log-48 likelihood provided by the function glm.nb to choose between models. The function glm.nb n ignores the term, - ^log(_y,.!), in the log-likelihood for the N B regression model and so the /=i values for the log-likelihood may take on positive values. Table 11 Summary of fits for N B regression models for NSB resistant at time 2 Model 2 x log likelihood Estimated Index of Dispersion df grp* weeks+NSB 1 -37.69 1.41 76 grp+weeks+NSB 1 -38.46 1.45 77 grp* weeks -38.02 1.43 77 grp+weeks -38.65 1.46 78 grp -38.65 1.46 79 weeks -45.64 1.82 79 Likelihood ratio tests can be performed by comparing twice the difference in log-likelihoods associated with two competing models, with quantiles of the Chi-square distribution having degrees of freedom equal to the difference in the number of parameters of the competing models. For example, comparing the model that includes both covariates, group and weeks with the model that only includes the covariate weeks, twice the difference in the log-likelihoods is 13.98 which is large for a Chi-square random variable having 1 degree of freedom. This indicates that the effect of group is significant. Similarly performed likelihood ratio tests indicate that weeks and NSB1 have an insignificant effect on NSB resistant. The model which considers the single covariate representing group membership provides as adequate a fit as any including additional covariates. 49 The residual deviance associated with this model is 83.77 which is not large enough relative to the degrees of freedom to suggest a lack of fit. The index of dispersion for the N B regression model, a , is estimated at about 1.4 and compared with its standard error is significantly different from zero. It appears that the NB regression model in this case adequately explains this data as it allows for the overdispersion to be present. The likelihood ratio test comparing the model with both covariates, group and weeks, and the model with the covariate, weeks, only indicates that the effect of the group is significant. A t-test based on the parameter estimate and its standard error agrees. The estimated model parameter for the effect of group membership is 0.913. This indicates that patients in group B tend to be infected with more resistant strains by the end of the study than patients in group A . Patients in group A are expected to be infected with e°0706 = 1.07 and patients in group B are expected to have e°9836 = 2.67 resistant strains by the end of the study. This was an effect that was not detected in the original Poisson regression analysis. The fit appears to have been greatly improved by the inclusion of a random effect term. However, we can examine the fit in more detail by comparing the observed frequencies of zero counts with the expected frequencies under the model. The observed and expected frequencies for NSB resistant in groups A and B are provided in Table 12. The expected frequencies are determined by the negative binomial probability mass function with parameters given by a =1.4, and A, = e° 0 7 0 6 for group A and X = e,0 9 8 3 9 for group B. Based on this comparison, the fit appears to be fairly adequate however, we still underestimate the number of zero counts in group A and overestimate the number of low counts. This suggests that separating the zero counts from the 50 positive counts as will be done in the ZIP regression model may provide a further improvement in the fit and give us an analysis in which we can have greater confidence. Table 12 Observed and expected frequencies for NSB resistant, NB regression model. (Expected frequencies based on the model are given in parentheses) NSB resistant Group A Group B Group A (cumulative) Group B (cumulative) 0 29 (21) 12(13) 29 (21) 12(13) 1 1(9) 2(7) 30 (30) 14 (20) 2 2(5) 2(5) 32 (35) 16 (25) 3 3(3) 8(4) 35 (38) 24 (29) 4 4(1) 7(3) 39 (39) 31 (32) 5 0(1) 6(2) 39 (40) 37 (34) 6 0(0) 2(1) 39 (40) 39 (35) 7 2(0) 1(1) 41 (40) 40 (36) The N B model specified in (3) is applied with Yt = NSB emergent resistant, for patient i at time 2, and x, = a vector of covariates for patient / . A summary of the model fits is provided in Table 13. Table 13 Summary of fits, NB regression models for NSB emergent resistant at time 2. Model 2 x log likelihood Estimated Index of Dispersion df grp* weeks+NSB 1 200.07 0.57 76 grp+weeks+NSB 1 199.95 0.57 77 grp* weeks 199.05 0.59 77 grp+weeks 199.02 0.59 78 grp 187.27 0.84 79 weeks 198.36 0.60 79 Comparing the values of the log-likelihood for the competing models indicates that the model considering the single covariate representing the number of weeks provides as adequate a 51 fit as models including additional terms. Adding the covariate representing group membership does not significantly improve the fit. Using a likelihood ratio test comparing the model with both covariates, group and weeks with the model that considers only group, we find that twice the difference in log-likelihoods of 23.5. This is large relative to a Chi-square distribution withl degree of freedom, indicating that group membership does not have a significant effect upon NSB emergent resistant. The residual deviance associated with this model is 105.71 on 79 degrees of freedom. Although the residual deviance has decreased substantially from those obtained using the ordinary Poisson regression model, it is still large relative to the degrees of freedom. There is still some evidence of a lack of fit. The index of dispersion for the N B regression model is estimated at about 0.59 and was also found to be significantly different from zero. The parameter representing the effect of the number of weeks is estimated at 0.088. This suggests that the longer a patient remained in the study the more likely they were to be infected with an emergent resistant strain of bacteria. Using the model with the single covariate representing the number of weeks, we examine the fit of this model in greater detail. Again we compare the observed frequencies of NSB emergent resistant with the expected frequencies under the model in Table 14. Patients did not all stay for the same number of weeks however twenty-nine patients stayed the entire sixteen weeks and so we compare the observed and expected frequencies for these twenty-nine patients. Again we underestimate the number of patients with zero NSB and we overestimate those with small positive counts. Our model does not separate the zero from the positive counts which would intuitively provide an improved fit. 52 Table 14 Observed and expected frequencies for NSB emergent resistant, N B regression model. (Expected frequencies under the model are given in parentheses) NSB emergent resistant Frequency Cumulative frequency 0 6(3) 6(3) 1 0(4) 6(7) 2 0(4) 6(11) 3 0(3) 6(14) 4 6(3) 12(17) 5 8(2) 20(19) 6 2(2) 22 (21) 7 5(2) 27 (23) 8 2(1) 29 (24) Finally, the N B regression model specified in (3) is applied with Yt = NSB combined, for patient i at time 2, and x/ = a vector of covariates for patient i . The fits for these models are summarized in Table 15. Table 15 A summary of fits of NB regression models for NSB combined at time 2. Model 2 x log likelihood Estimated Index of Dispersion df grp* weeks+NSB 1 650.95 0.38 76 grp+weeks+NSB 1 650.95 0.38 77 grp* weeks 650.95 0.38 77 grp+weeks 650.95 0.38 78 642.23 0.48 79 weeks 649.78 0.40 79 Comparing the values of the log likelihood for the above models indicates that the model containing the single covariate representing the number of weeks provides as adequate a fit as models including additional terms. The residual deviance is vastly improved over ordinary 53 Poisson regression however the residual deviance associated with this model is 108.32 on 79 degrees of freedom which still provides some evidence of a lack of fit. The effect of group membership does not appear to be significant, however the effect of the number of weeks a patient remains in the study does appear to have a significant effect on NSB combined at time 2. The estimate of the parameter for the number of weeks is 0.0597 indicating that the longer a patient remains in the study the more likely they are to be infected with some form of resistant strains of bacteria. Using the model with the single covariate, number of weeks, we can examine the fit of this model in more detail. In Table 16, the observed and expected frequencies for NSB combined are compared. Although, the model does not underestimate the number of zero counts this time, it does still overestimate the number of low positive counts and underestimates the number of somewhat higher positive counts. Clearly, the zero counts are well separated from the positive counts and this feature is not captured by the N B regression model. Table 16 Observed and expected frequencies for NSB combined, N B regression model. (Expected frequencies based on the model are given in parentheses) NSB combined Frequency Cumulative frequency 0 1(1) 1(1) 1 1(2) 2(3) 2 1(3) 3(6) 3 0(3) 3(9) 4 2(3) 5(12) 5 7(3) 12(15) 6 1(2) 13 (17) 7 5(2) 18 (19) 8 6(2) 24 (21) 9 1(2) 25 (23) 10 1 0 ) 26 (24) 11 2(1) 28 (25) 12 1(1) 29 (26) 13 0(1) 29 (27) 14 0(1) 29 (28) The N B regression model did offer some improvement over the ordinary Poisson regression model in terms of its ability to account for the apparent overdispersion in these data. However, the model was still unable to explain the large number of zero counts that were observed. This is further evidence that a ZIP model, where we can separate the zero data may provide improved fits for all three counts, NSB resistant, emergent resistant and combined. 3.3 Application 2: Results and Discussion The daily units sold appear to vary more than can be accounted for by a Poisson distribution. The ordinary Poisson regression was consequently unable to adequately model these data. If one allows for a random effect associated with the individual observations (or days) to be incorporated into the model, the NB regression model can be applied to these data. 55 Instead of covariates however, our model will use the two factors, store location and day of the week to predict the Poisson mean. The model is specified below. (YyluXy) ~ Poisson(u^) u ~ Gamma(a,a), E(y>) = 1, Var(v) = a < °o so that E(YU ) = \ , and Var(YH) = \ . (1 + a\) l n ( \ ) = a + p. + y j . , i = 1 21 and j = l,...,7 P, represents the effect of store i on the units sold and y . represents the effect of the day of the week j. The parameters for store 1 and Monday are set to zero, so the rate for store 1 on Monday is simply determined by the parameter a . Fitting this model to the data resulted in a significant improvement. The deviance dropped to a value of 6434.70 on 6567 degrees of freedom and the index of dispersion, a is estimated at .60. A goodness of fit test finds that this deviance is not large enough relative to the degrees of freedom to provide evidence of a lack of fit. At first glance it appears that incorporating random effects into the Poisson regression model has allowed us to adequately explain the overdispersion observed in this data. Comparing the value of the log likelihood of the model with both factors to that of more parsimonious models where one of the factors is dropped indicates that both store and day of the week are significant in determining the number of units sold on a particular day at a particular location and so both factors are retained. A summary of the estimated model parameters along with their standard errors in provided in Table 17. 56 Table 17 Estimated model parameters and standard errors for the N B regression model for the units sold Parameter Parameter estimate Standard error intercept -0.566 0.096 store 2 -0.177 0.126 store 3 0.708 0.110 store 4 0.775 0.109 store 5 0.018 0.122 store 6 0.138 0.119 store 7 0.715 0.110 store 8 -0.253 0.128 store 9 0.429 0.114 store 10 0.352 0.115 store 11 -0.253 0.128 store 12 0.537 0.112 store 13 0.024 0.121 store 14 0.518 0.112 store 15 0.370 0.115 store 16 -0.060 0.123 store 17 0.267 0.117 store 18 0.577 0.112 store 19 -0.021 0.122 store 20 0.019 0.122 store 21 0.309 0.116 Tuesday -0.106 0.066 Wednesday -0.063 0.065 Thursday -0.063 0.065 Friday -0.035 0.065 Saturday 0.215 0.062 Sunday 0.114 0.063 In order to evaluate the performance of this model we compare the observed number of days when zero units were sold with the number of days expected under the N B regression model. Table 18 provides the observed and expected number of days broken down by store and by day of the week. We do not underestimate the number of zeroes as often as with the Poisson 57 regression model. The NB regression model appears to have improved the fit with respect to the number of days when zero units are sold. Table 18 Observed and expected number of days with zero units sold, N B regression model. (Expected number of zeroes are given in parentheses) Store Monday Tuesday Wednesday Thursday Friday Saturday Sunday 1 26 (28) 28 (29) 38 (28) 25 (28) 27 (28) 22 (25) 27 (26) 2 33 (30) 31 (31) 29 (30) 32 (30) 32 (30) 23 (27) 28 (28) 3 20(19) 20 (20) 18(20) 16(19) 18(19) 17(16) 13 (17) 4 14(18) 17(19) 20(19) 19(18) 23 (18) 7(15) 13 (16) 5 24 (27) 31 (28) 29 (28) 26 (27) 29 (28) 25 (25) 26 (26) 6 27 (26) 30 (27) 26 (27) 24 (26) 30 (26) 28 (23) 26 (25) 7 23 (19) 20 (20) 24 (19) 20(19) 18 (19) 17(16) 15(17) 8 35 (30) 28 (32) 30(31) 39 (30) 28 (31) 29 (28) 36 (29) 9 18(22) 20 (24) 28 (23) 19 (23) 26 (23) 18(20) 17(21) 10 20 (23) 23 (25) 19 (24) 23 (23) 26 (24) 18(21) 21(22) 11 35 (30) 31 (31) 20 (31) 29 (30) 31 (31) 23 (28) 32 (29) 12 22 (21) 24 (22) 16(22) 20 (21) 24 (21) 24(18) 19(19) 13 21 (27) 28 (29) 26 (28) 32 (27) 28 (28) 26 (25) 30 (26) 14 20 (21) 17(23) 24(22) 19(21) 25 (22) 20(18) 17(20) 15 28 (23) 26 (24) 19 (24) 22 (23) 25 (23) 22 (20) 17 (22) 16 29 (28) 33 (29) 31 (29) 28 (28) 27 (29) 22 (26) 27 (27) 17 23 (24) 28 (26) 20 (25) 27 (25) 24 (25) 21 (22) 25 (23) 18 24 (20) 21 (22) 27 (21) 23 (21) 20 (21) 17(17) 11(19) 19 25 (28) 33 (29) 29 (29) 26 (28) 27 (28) 23 (25) 30 (26) 20 29 (27) 28 (29) 27 (28) 25 (27) 28 (28) 29 (25) 29 (26) 21 21 (24) 23 (25) 22 (25) 24 (24) 26 (24) 25 (21) 21(22) 58 4 Zero Inflated Poisson Regression Model %.l Methodology When the variance conditioned on the covariates in a Poisson regression model exceeds the mean, overdispersion is indicated. If there are a large number of observations when the count response variable is equal to zero and other observations when the count is relatively large, the variance will also exceed the mean. In this situation, however, the overdispersion is more accurately explained by the fact that more zeroes than can be accounted for by a Poisson distribution are observed. In addition, there are often physical explanations for why this is so. For example, Wang, Puterman, Cockburn and Le (Wang, Puterman, Cockburn, Le, 1996) model daily seizure frequency in epileptic children. The children have bad days when the experience a number of seizures and good days when they children are seizure free. A second example is when Lambert models the number of defects in printed circuits boards which can be produced in a perfect state, in which no defects occur, or an imperfect state where a number of defects may occur (Lambert, 1992). This kind of information can be incorporated into a Poisson regression model by allowing an extra mass at zero. Using ZIP regression, one can model this extra probability of zeroes in addition to the rate as depending on covariates. In this way, the overdispersion can be modeled and inference can be made regarding this inherent feature of the data. 59 The ZIP regression model is specified as follows. Yt = 0, with probability pt. Yj ~ Poisson(A,I) with probability 1 - p.,. V ' {(l-p^X*/k\, f o r £ > 0 w Further Xi and pi satisfy, log(X.() = x(P , where p represents a vector of parameters and x, a vector of covariates. ( \ log '•— = z,y , where y represents a vector of parameters and z, a vector of covariates. This model is flexible in that one can use different covariates to model the extra probability of zeroes and the Poisson rate. In an alternative model, one can allow p and X to be functionally related (see Lambert, 1992). The likelihood for the ZIP regression model specified in (5) is n [ e*« | e x p ( - g ^ ) | T - r e x p ( - g ' t - p ) g ^ i i j ( l + ^ ) (l + e") J i i (l + e^)yi\ Ignoring the term log(v,!) , the log-likelihood is y,>0 1 = X - log(l + e"1) + X log(exp(-e^ ) +e*» ) + £(x, .p V / -e*<p). (6) 1=1 ,y,=0 ' y,>0 M L E ' s for the model parameters can be obtained by maximizing (6) with respect to the parameters in P and y . 60 The maximization can be performed using a number of alternative algorithms. Lambert discusses the use of the E M algorithm to maximize (6) and Chambers and Hastie discuss using the Newton-Rapheson algorithm used by the Splus function ms which requires that at least the partial first derivatives with respect to the parameters of (6) be specified. I use the Splus function, nlmin, instead to find the minimum of the negative log-likelihood. This function uses an algorithm based on a quasi-Newton method developed by Dennis, Gay, and Welsch (Dennis, Gay, and Welsch, 1981). The estimated parameters from a Poisson regression model for only the positive counts provides initial estimates for the parameters in p and the estimated f l , i f^ = 0 parameters from a logistic regression on >>' = <! ^ ^ provide initial estimates for the parameters in y . The procedure and code used to fit the ZIP regression models is provided in Appendix 1 together with first partial derivatives of (6) with respect to the model parameters. 4.2 Application 1: Results and Discussion The exploratory analysis in section 2.2.2 and the results of the Poisson regressions in section 2.2.3 both suggest that the observed overdispersion in these data may be modeled well by allowing an extra mass at zero. The ZIP regression model specified in (5) was applied to these data and here we summarize the results. We allowed for a different set of covariates to be used in modeling the extra probability of zeroes and the Poisson mean. For each of NSB resistant, emergent resistant and combined we fit a total of sixteen models. This was because we considered four models for each the extra probability of zeroes and the rate. The four models were based on including all or a subset of the 61 covariates representing group membership, the number of weeks in the study, and the interaction between the two. Specifically the covariates for each of the four models are; - group*weeks, group and weeks (group*weeks represents the interaction) - group and weeks - group only - weeks only In order to evaluate the performance of the ZIP regression model one of the sixteen models for each of NSB resistant, emergent resistant and combined is selected. The fit of the model selected is then examined. The model selection procedure is based on comparing the values for the log-likelihood associated with each of the fitted models. The selected model will exclude the covariates that are found to have an insignificant effect on NSB, and as such the model selection procedure also allows us to make inference regarding the effects of the covariates on NSB. Table 19 provides the values of the log-likelihood for each of the sixteen models for NSB resistant. The values for the log-likelihood in Table 19 were calculated ignoring the negative constant, ^ - log(_jA ! ) , and so may take on positive values. y,>0 Table 19 Log-likelihood based on ZIP regression models for NSB resistant. (Degrees of freedom are given in parentheses) 1 Covariates for A, Covariates for p group*weeks group+weeks group weeks no covariates group*weeks 2.4022 (74) 2.3388 (75) 2.0329 (76) 2.3383 (76) group+weeks 1.7700 (75) 1.7462 (76) 1.3839(77) 1.7461 (77) group 1.7331 (76) 1.7067 (77) 1.3708 (78) 1.7066 (78) 1.3411(79) weeks -5.0978 (76) -5.1009 (77) -5.1323 (78) -5.3714(78) 62 One can determine the significance of a covariate in both of the submodels (one for p and one for X) by comparing log-likelihoods in the diagonal cells in Table 19. The log-likelihood changes little when the interaction is dropped demonstrating the insignificant of this term on NSB. The log-likelihood changes little when the covariate, weeks, is further dropped from the model. The model that considers the single covariate representing group membership for the extra probability of zeroes provides as adequate a fit to these data as any models containing additional terms. This model is selected as being the most parsimonious to provide an adequate fit. When the covariate for p representing group membership is dropped from the model, the log-likelihood decreases dramatically. The likelihood ratio test based on comparing the model for p with the single covariate, weeks with the model including the covariates, group and weeks, indicates that group membership has a significant effect upon the probability of extra zeroes. The model states that, log(X,) = 1.303, and log f p. \ \ 0.846, if patient i is in group A [0.846 -1.781, if patient i is in group B ' This indicates that patients in group B are more likely to be infected with at least one resistant strain of bacteria by the end of the study. It also indicates that although patients in group B are more likely to have at least on resistant strain of bacteria, that the rate of infection among those infected does not differ significantly between the two groups. Of those patients suffering from an infection with a resistant strain of bacteria at the end of the study, the expected number of strains is e 1 3 0 3 = 3.68. This inference is dramatically different from that taken from the N B regression analysis. Instead of concluding that the two groups experience different rates of infection we find that the two groups experience a different probability of being infected at the end of the study. Patients in group B are found to be more likely to be infected with resistant 63 strains of bacteria at the end of the study but that the rate of infection does not differ between the two groups. In order to evaluate how well this model fits the data, we compare the observed frequencies with those we expect under the model. Table 20 provides the observed and expected frequencies for NSB resistant. Table 20 Observed and expected frequencies for NSB resistant, ZIP regression model. (Expected frequencies are given in parentheses) NSB resistant Group A Group B 0 29 (29) 12(12) 1 1(1) 2(3) 2 2(2) 2(5) 3 3(3) 8(6) 4 4(2) 7(6) 5 0(2) 6(4) 6 0(1) 2(2) 7 0(1) 1(1) The ZIP regression model provides a remarkably improved fit for these data over the alternative models. The model no longer underestimates the number of zeroes nor overestimates the number of low counts. The Poisson regression model seriously underestimated the number of patients with zero counts. Of those patients who remained in the study the entire sixteen weeks, the Poisson regression model expected 4 of the patients in group A and 1 of the patients in group B to have zero counts when there were 11 and 18 respectively. Among all patients in the study, under the N B regression model, we expect to see 21 patients in group A and 13 in group B with zero counts when in actuality there are 29 in group A and 12 in group B. The ZIP regression model appears to have and improved fit over the N B regression model in this case. 64 Table 21 provides the values for the log-likelihood associated with the sixteen ZIP regression models for NSB emergent resistant. Table 21 Log-likelihood based on ZIP regression models for NSB emergent resistant. (Degrees of freedom are given in parentheses) Covariates for X Covariates for p group*weeks group+weeks group weeks no covariates group*weeks 137.806 (74) 137.791 (75) 137.167 (76) 137.754 (76) group+weeks 137.239 (75) 137.193 (76) 136.566 (77) 137.151 (77) group 130.809(76) 130.768 (77) 139.969 (78) 130.733 (78) weeks 136.412 (76) 136.368 (77) 135.746 (78) 136.340 (78) 135.679 (79) The model that considers the single covariate, weeks, for p provides as adequate a fit for the data as any models the include additional terms. Group membership has no significant effect upon either the extra probability of zeroes or the Poisson mean. That is, the two treatments compared do not differ significantly in their effect on NSB emergent resistant. A likelihood ratio test comparing the model with the two covariates, group and weeks, with the model using only group for p, indicates that the number of weeks the patients remain in the study does have a significant effect on the extra probability of zeroes. The model states that, log(A,() = 1.64 and log 1.14 - 0.17(x,.), where x, represents the number of weeks that patient / remained in the study. This implies that the longer a patient remains in the study, the more likely they are to suffer from at least one infection with an emergent resistant strain of bacteria. Of those patients suffering from such an infection, the expected number of different emergent resistant strains is e 1 6 4 = 5.15 . In order to evaluate the how well the model fits the data we compare, the observed frequencies of NSB emergent resistant and the expected frequencies under the model. Table 22 65 provides the observed and expected frequencies for those patients who remained in the study the full sixteen weeks. Table 22 Observed and expected frequencies for NSB emergent resistant, ZIP regression model. (Expected frequencies are given in parentheses) NSB resistant Frequency 0 6(5) 1 0(1) 2 0(2) 3 0(3) 4 6(4) 5 8(4) 6 2(4) 7 5(3) 8 2(2) Under the Poisson regression model we expected to see no zero counts of NSB emergent resistant and under the NB regression model we expected to see 3 such patients when in actuality there are 6. The ZIP regression model appears to fit these data fairly well. We no longer seriously underestimate the number of patients with zero or high counts for NSB emergent resistant, however we still overestimate the number of patients with low counts. Table 23 provides the values for the log-likelihood associated with the sixteen ZIP regression models for NSB combined. 66 Table 23 Log-likelihood based on ZIP regression models for NSB combined. (Degrees of freedom are given in parentheses) Covariates for X Covariates for p group*weeks group+weeks group weeks no covariates group*weeks 354.723 (74) 354.454 (75) 354.440 (76) 353.491 (76) group+weeks 354.707 (75) 354.440 (76) 354.426 (77) 353.479 (77) group 346.015 (76) 345.750 (77) 345.100 (78) 344.793 (78) weeks 354.438 (76) 354.119(77) 354.098 (78) 353.140 (78) 353.094 (79) The model that includes the single covariate representing the number of weeks for p and no covariates for the Poisson mean provides as adequate a fit as any models containing additional terms. The effect of weeks on NSB combined is significant as the log-likelihood drops dramatically when this covariate is removed from the model. The model states that, log(^) = 1.89 and log Pi U - J V = 0.98 - 0.25(x,.), where xt represents the number of weeks that patient i remained in the study. This implies again that the longer a patient remains in the study the more likely they are to suffer from at least one infection with a resistant or an emergent resistant bacteria. Among those patients suffering from such an infection the expected number of different strains is e 1 8 9 = 6.62 . We can compare the observed frequencies of NSB combined with those expected under the above model in order to evaluate the model's performance. Table 24 provides a comparison between the observed frequencies and those that are expected under the above model for those patients who remained in the study the entire sixteen weeks. 67 Table 24 Observed and expected frequencies for NSB combined, ZIP regression model. (Expected frequencies are given in parentheses) NSB resistant Frequency 0 1(2) 1 1(1) 2 1(2) 3 0(4) 4 2(5) 5 7(5) 6 1(4) 7 5(3) 8 6(2) 9 1(1) 10 1(1) 11 2(0) 12 1(0) It was not so apparent that at least for those patients remaining in the study the full sixteen weeks there was an excessive number of zero counts for NSB combined. The ZIP model does not however overestimate the number of zero counts and provides a somewhat improved fit over the Poisson regression model. 4.3 Application 2: Results and Discussion Both the exploratory data analysis in section 2.3.2 and the investigation into the fits of the preliminary models in section 2.3.3 suggest that these data may also be well modeled by a ZIP regression model. In this section we fit a ZIP regression model to the daily units sold. The model is specified as follows. Y) i. = 0, with probability /?, . Y,. ~ Poisson( A. y) with probability 1 - pt . 68 P(Y =k) = Further Xy and P j satisfy p,y{\-Pi.)e- \ for/< = 0 (1 - P l j )e~h>X , ,*/*! , f o r £ > 0 l o g ( \ ) = a + p. + y , and log = a + P , + y j, where P, , P , represent th the effect of store i and y ., y . represent the effect of the j day of the week. The parameters, P,, P 1 and y , , y, are all taken to be zero, so P, and P , represent the effect of store i relative to store 1 and y . and y . represent the effect of the j day of the week relative to Monday. We consider three models for X {j and three models for ptj for a total of nine models. The three models for X / ; and P j j consider either both factors, store and day of the week, store only, or day of the week only. In order to evaluate the performance of the ZIP regression model we need to select one of the nine models. The selection will be again based on comparing the values of the log-likelihood. Table 25 provides the values of the log-likelihood for the nine models. Table 25 Log-likelihood for ZIP regression models for the daily units sold (Degrees of freedom are given in parentheses) Factors for the Poisson mean Factors for the extra prob. of zeroes store + day of the week store day of the week store + day of the week -5916.183 (6540) -5927.524 (6546) -5989.490 (6560) store -5919.010 (6546) -5942.470 (6552) -5991.091 (6566) day of the week -5937.067 (6560) -5948.819 (6566) -6117.093 (6580) 69 The model that considers both factors, store and day of the week for the mean and the single factor representing the store for the extra probability of zeroes provides as adequate a fit as models containing the additional factor. Likelihood ratio tests indicate that both the store and the day of the week have a significant effect on the mean number of units sold. The effect of the store on the probability of extra zeroes is also significant however the effect of the day of the week is not significant after the store has been taken into account. Table 26 provides the estimated model parameters for the ZIP regression model which considers both factors for the mean and the single factor, store, for the extra probability of zeroes. 70 Table 26 Estimated model parameters, ZIP regression model for units sold a , Pz , 1j For X y For pu a , intercept (Store 1, Mon.) -0.059 -0.484 store 2 -0.217 0.025 store 3 0.410 -0.966 store 4 0.470 -1.106 store 5 -0.106 -0.234 store 6 0.162 0.137 store 7 0.556 -0.385 store 8 -0.012 0.628 store 9 0.149 -0.833 store 10 0.065 -0.879 store 11 -0.280 0.019 store 12 0.390 -0.370 store 13 -0.074 -0.164 store 14 0.276 -0.700 store 15 0.182 -0.494 store 16 -0.160 -0.155 store 17 0.222 -0.057 store 18 0.381 -0.531 store 19 -0.141 -0.215 store 20 -0.012 0.008 store 21 0.112 -0.528 Tuesday -0.109 Wednesday -0.053 Thursday -0.058 Friday -0.030 Saturday 0.221 Sunday 0.095 Table 27 provides the observed number of days when zero units were sold and the expected number under the above ZIP regression model. Again the fit appears to have improved over the Poisson regression. Table 27 Observed and expected number of days with zero units sold, ZIP regression model. (Expected frequencies are given in parentheses) Store Monday Tuesday Wednesday Thursday Friday Saturday Sunday 1 26 (28) 28 (29) 38 (28) 25 (28) 27 (28) 22 (26) 27 (27) 2 33 (30) 31 (31) 29 (31) 32 (30) 32(31) 23 (28) 28 (29) 3 20(17) 20(19) 18(18) 16(18) 18(18) 17(15) 13 (16) 4 14(16) 17(17) 20(17) 19(16) 23 (16) 7(13) 13(15) 5 24 (28) 31 (29) 29 (28) 26 (28) 29 (28) 25 (25) 26 (27) 6 27 (27) 30 (28) 26 (28) 24 (27) 30 (28) 28 (25) 26 (26) 7 23 (19) 20 (20) 24 (20) 20 (20) 18 (20) 17(17) 15 (18) 8 35 (32) 28 (33) 30 (33) 39 (32) 28 (33) 29 (31) 36 (32) 9 18(21) 20 (23) 28 (22) 19(22) 26 (22) 18 (19) 17 (20) 10 20 (22) 23(24) 19(23) 23 (23) 26 (23) 18(19) 21 (21) 11 35 (31) 31 (32) 20 (31) 29 (31) 31 (31) 23 (29) 32 (30) 12 22 (21) 24 (23) 16(22) 20 (21) 24 (22) 24(19) 19(20) 13 21 (28) 28 (29) 26 (28) 32 (28) 28 (28) 26 (25) 30 (27) 14 20 (21) 17(22) 24(21) 19(21) 25 (21) 20(18) 17(19) 15 28 (23) 26 (24) 19 (23) 22 (23) 25 (23) 22 (20) 17(22) 16 29 (29) 33 (30) 31 (29) 28 (29) 27 (29) 22 (26) 27 (28) 17 23 (25) 28 (26) 20 (26) 27 (25) 24 (26) 21 (23) 25 (24) 18 24 (20) 21 (22) 27 (21) 23 (20) 20 (21) 17(18) 11(19) 19 25 (28) 33 (29) 29 (29) 26 (28) 27 (28) 23 (26) 30 (27) 20 29 (28) 28 (29) 27 (29) 25 (28) 28 (28) 29 (26) 29 (27) 21 21 (23) 23 (25) 22 (24) 24 (24) 26(24) 25 (21) 21(22) 72 5 Discussion and Suggestions for Further Study The ZIP regression model clearly provided a superior fit to that of Poisson regression. It also performed at least as well as the NB regression, and in the case of modeling the number of resistant strains in the first application, was clearly superior to both alternative models. In the first application, both the Poisson and the N B regression models underestimated the number of patients having zero counts for NSB resistant. Under the ZIP regression model, the expected number of patients with zero counts agreed perfectly with the actual data. The fit was also improved for NSB emergent resistant but the improvement was not as dramatic. In addition the inferences with respect to NSB resistant made using the three analyses differed dramatically. With Poisson regression, the effect of the treatment group on NSB resistant was found to be insignificant after we adjusted the standard errors using the quasi-likelihood method. Both the N B regression and ZIP regression analyses found that the treatment group had a significant effect upon NSB resistant. However, the ZIP regression analysis found this effect only to be significant in determining the probability that a patient have at least one resistant strain and not in the rate. In this way, the ZIP regression model allowed us to gain insight as to the nature of the cause of the overdispersion itself rather than treating the overdispersion as a nuisance parameter. A summary of the comparison of the three models used in the first application is provided in Table 28. 73 Table 28: Model performance comparison NSB resistant NSB emergent resistant NSB combined Model Fit Inference Fit Inference Fit Inference Poisson Poor. Effect of Poor. Effect of Difficult to Effect of regression Seriously treatment Under- treatment evaluate. treatment under- group not estimates the group not Does not group not estimates the significant. number of significant. appear to significant. number of zeroes. Effect of seriously Effect of zeroes in the weeks found under-estimate weeks data. to be significant. the number of zeroes. marginally significant. NB Poor. Effect of Improved Effect of Does not Effect of regression Under- treatment but still treatment appear to treatment estimates the group under- group not seriously group not number of found estimates the significant. under-estimate significant. zeroes and significant. number of Effect of the number of Effect of over- zeroes and weeks found zeroes but weeks estimates the over- to be does over- significant. number of estimates the significant. estimate the low counts. number of low counts. number of low counts ZIP Vastly Effect of Vastly Effect of Appears to be Effect of regression improved. treatment improved. treatment marginally treatment group Still over- group not improved. group not significant estimates the significant. Still over- significant. only for number of Effect of estimates the Effect of the prob. low counts. weeks found number of low weeks of at least to be counts. significant one strain. significant but only for the prob. of at least one strain. only for the prob. of at least one strain. In the second application, both the NB and the ZIP regression models provided an improved fit over Poisson regression. The Poisson regression seriously underestimated the number of days when zero units of the product were sold. With both the N B and ZIP regression models this problem was alleviated. The inferences drawn from the N B regression model did not differ from those drawn from the Poisson regression model. On the other hand, the inferences drawn from the ZIP regression model differed from those of both the Poisson and the N B 74 regression models. The ZIP regression model suggested that although both factors, store and day of the week, had a significant effect on the number of units sold, only the store had a significant effect on the probability that at least one units was sold. This again allows us some insight as to the nature of the overdispersion present in this data. Both tests for overdispersion described in Sections 2.1.1 and 2.1.2 clearly indicated its presence. However, these tests could not be used as the basis for selecting one of the two alternative models to provide and improved fit. A thorough exploratory analysis, instead, provided a relatively clear indication that a ZIP model would provide an improved fit. This stresses the importance of such an exploratory analysis as an aid to the statistician attempting to identify appropriate models. In addition, whenever possible, physical models should also be considered. To my knowledge, there is no standard software available currently that can be used to obtain the M L E ' s in the ZIP regression model. Since working with zero inflated data, a number of colleagues have inquired as to how such a model may be implemented. The procedure is not straightforward and must be adapted to the specific form of model used. The development of software that is flexible enough to accommodate a number of variations on the ZIP regression model used here would likely be valuable for a large number of applied statisticians and subject area researchers. Although the Splus function, nlmin, was used here to fit the ZIP regression models, other methods exist which use different algorithms to obtain the M L E ' s . A serious investigation that compares the performance of the E M algorithm suggested by Lambert, the Newton-Raphson algorithm and the quasi-Newton algorithm used to obtain M L E ' s here may provide some 75 assistance to those wishing to fit ZIP regression models in future applications and in the development of software. In summary, as overdispersion is a relatively common feature in Poisson regression models, models which can accommodate the overdispersion are greatly needed. Identification of which alternative model may be best suited to a particular application may be aided by a number of tests developed to detect specific forms of overdispersion together with a thorough examination of the data using exploratory tools. The ZIP regression model provides yet another alternative model that is appropriate in a number of situations and may provide both an improved fit for the data and allow a greater depth of inference. Bibliography Aitchison, J., and Ho, C.H., (1989), "The Multivariate Poisson log-normal Distribution", Biometrika, 76, 643-653. Anderson, R.U., (1985), Editorial, Journal of the American Paraplegia Association, 8, 18. Breslow, N.E. , (1990), "Tests of Hypotheses in Overdispersed Poisson Regression and Other Quasi-likelihood Models", Journal of the American Statistical Association, 85, 565-571. Breslow, N.E. , and Clayton, D.G., (1993), "Approximate Inference in Generalized Linear Mixed Models", Journal of the American Statistical Association, 88, 9-25. Cameron, A.C. , and Trivedi, P.K., (1990), "Regression-Based Tests for Overdispersion in the Poisson Model", Journal of Econometrics, 46, 347-364. Chambers, J .M., and Hastie, T.J., (1992) Statistical Models in Splus, California: Wadsworth and Brooks Cole. Dean, C.B., (1992), "Testing for Overdispersion in Poisson and Binomial Regression Models", Journal of the American Statistical Association, 87, 451-457. Dean, C.B., Lawless, J.F., and Willmot, G.E., (1989), " A Mixed Poisson-Inverse Gaussian Regression Model", The Canadian Journal of Statistics, 17, 171-181. Dean, C , and Lawless, J.F., (1989), "Test for Detecting Overdispersion in Poisson Regression Models", Journal of the American Statistical Association, 84, 467-472. Ganio, L . M . , and Schafer, P.W., (1992), "Diagnostics for Overdispersion", Journal of the American Statistical Association, 87, 795-804. Gribble, M.J. , McCallum, N . M . , and Schechter, M.T., (1988), "Evaluation of Diagnostic Criteria for Bacteriuria in Acutely Spinal Cord Injured Patients Undergoing Intermittent Catheterization", Diagnostic Microbiology and Infectious Diseases, 9, 197-206. Jansen, J., (1993), "Analysis of Counts Involving Random Effects with Applications in Experimental Biology", Biometrical Journal, 6, 745-757. Johnson, N .L . , Kotz, S., and Kemp, A.W., (1992), Univariate Discrete Distributions, second edition, New York: John Wiley and Sons, Inc. 77 Kapalka, B.A. , Katircioglu, K. , Puterman, M.L . , (1995), "Inventory Control in a Retail Environment with Lost Sales and Service Constraints", Bramss working paper, 3, Faculty of Commerce and Business Administration, Vancouver, B.C.: The University of British Columbia. Lambert, D., (1992), "Zero Inflated Poisson Regression, With an Application to Defects in Manufacturing", Technometrics, 34, 1-13. Lawless, J.F., (1987), "Negative Binomial and Mixed Poisson Regression", The Canadian Journal of Statistics, 15, 209-225. McCullagh, P., and Nelder, J.A., (1983), Generalized Linear Models, London:Chapman and Hall. Merrit, J.L., (1976), "Urinary Tract Infections, Causes and Management, with Particular Reference to the Patient with Spinal Cord Injury: A Review", Archives of Physical Medicine and Rehabilitation, 57, 365-378. Pearman, J.W., (1984), "Infection Hazards in Patients with Neuropathic Bladder Dysfunction", Journal of Hospital Infection, 5, 355-372. Ripley, B.D., and Venables, W.N. (1994), Modern Applied Statistics with Splus, New York: Springer-Verlag. Stein, G.Z., (1988), "Modelling Counts in Biological Populations", Mathematical Scientist, 13, 56-65. Van den Broek, J., (1995), " A Score Test for Zero Inflation in a Poisson Distribution", Biometrics, 51, 738-743. Wang, P .M. , Puterman, M.L . , Cockburn, I., Le, N . , (1996) "Mixed Poisson Regression Models with Covariate Dependent Rates", Biometrics, in Press. Wedderburn, R.W.M. , (1974), "Quasi-likelihood Functions, Generalized Linear Models and the Gauss-Newton Method", Biometrika, 61, 439-477. 78 Appendix Procedure for Fitting a ZIP Regression Model Using the software package, Splus, a ZIP regression model can be used to model a count response variable with the following procedure. y<-response variable pos<-y>0 yO<-ifelse(y<-0,l,0) posy<-y[pos] m 1 <-glm(y[pos]~covariates[pos], family=poisson) m2<-glm(y0~covariates, family^binomial) th<-c(coefficients(m 1), coefficients(m2) p<-no. of parameters in m l zipmodel<-nlmin(zip, th, ...) zip<-function(theta) { k<-length(theta) beta<-theta[l:p] gam<-theta[p+l:k] S<-Xdesl %*% beta G<-Xdes2 %*% gam eS<-exp(S) zero<-y<0.5; pos<-!zero lkh<-logexp(G) lkh[pos]<-lkh[pos] - y[pos] * S[pos] + eS[pos] lkh[zero]<-lkh[zero] + eS[zero] - logexp(eS[zero] + G[zero]) sum(lkh) } where, Xdes 1 <-model .matrix(m 1) Xdes2<-model. matrix(m2) 79 logexp<-function(x) { y<-x pos<-x>0 y[pos]<-x[pos] + logexp.neg(- x[pos]) y[!pos]<- logexp.neg(x[!pos]) y } logexp.neg<-function(x) { y<-exp(x) smalK- y<4*.Machine$double.eps y[small]<-y[small] * (l-0.5*y[small]) y[!small]<-log(l +y [Ismail]) } Note: The design matrix can be made to give the constraints used in sections 2.3.3, 3.3 and 4.3 by issuing the command, options(constraints= "contr.treatment") prior to fitting the models in m l and m2. This procedure was adapted from the procedure provided by Chambers and Hastie (Chambers, and Hastie, 1992) who use instead the function, ms, to perform the minimization of the negative log-likelihood. Using this procedure requires that at least the first partial derviatives of the negative log-likelihood be supplied. The first partial derivatives of /,.(P,y ) are as follows. d(?,(P,Y) 9(P,) * f fCv,-e*p), for v, > 0 exp(e*'p +zjy)xjjeXil for v, = 0 — x e u + (l + exp(e*''p +z,y) d(/,(P,Y) 8<yj) (l + e Z i T ) ' - x,,er ,T xv exp(e^'p + z j ) for v, > 0 (1 + ez,y ) (1 + exp(eJtiP + z,y )) ' for V / =0 80 where x,.. is the if entry of the design matrix, Xdesl, and ztj is the ij entry of the design matrix, Xdes2. Note that no information toward the covariates in the extra probability of zeroes is provided from positive values of the response variable.
- Library Home /
- Search Collections /
- Open Collections /
- Browse Collections /
- UBC Theses and Dissertations /
- Modeling zero inflated count data
Open Collections
UBC Theses and Dissertations
Featured Collection
UBC Theses and Dissertations
Modeling zero inflated count data Garden, Cheryl Ellen 1996
pdf
Page Metadata
Item Metadata
Title | Modeling zero inflated count data |
Creator |
Garden, Cheryl Ellen |
Date Issued | 1996 |
Description | A natural approach to analyzing the effect of covariates on a count response variable is to use a Poisson regression model. A complication is that the counts are often more variable than can be explained by a Poisson model. This problem, referred to as overdispersion, has received a great deal of attention in recent literature and a number of variations on the Poisson regression model have been developed. As such, statistical consultants are faced with the difficult task of identifying which of these alternative models is best suited to their particular application. In this thesis, two applications where the data exhibit overdispersion are investigated. In the first application, two treatments for chronic urinary tract infections are compared. The response variable represents the number of resistant strains of bacteria cultured from rectal swabs. In the second application, the number of units sold of a product are modeled as depending on two factors representing the day of the week and the store. Two alternative models that allow for overdispersion are used in both applications. The negative binomial regression model and the zero inflated Poisson regression model so named by Lambert (Lambert, 1992) provide improved fits. Further, the zero inflated Poisson regression model performs particularly well in the situation when the overdispersion is suspected to be due to a large number of zeroes occurring in the data. The zero inflated Poisson regression model allows one to both fit the data well and make some inference regarding the nature of the overdispersion present. This little known model may prove to be valuable as there exist a number of applications where observed overdispersion in a count response variable is clearly due to an inflated number of zeroes. |
Extent | 3575052 bytes |
Genre |
Thesis/Dissertation |
Type |
Text |
FileFormat | application/pdf |
Language | eng |
Date Available | 2009-02-11 |
Provider | Vancouver : University of British Columbia Library |
Rights | For non-commercial purposes only, such as research, private study and education. Additional conditions apply, see Terms of Use https://open.library.ubc.ca/terms_of_use. |
DOI | 10.14288/1.0099036 |
URI | http://hdl.handle.net/2429/4495 |
Degree |
Master of Science - MSc |
Program |
Statistics |
Affiliation |
Science, Faculty of Statistics, Department of |
Degree Grantor | University of British Columbia |
GraduationDate | 1996-05 |
Campus |
UBCV |
Scholarly Level | Graduate |
AggregatedSourceRepository | DSpace |
Download
- Media
- 831-ubc_1996-0219.pdf [ 3.41MB ]
- Metadata
- JSON: 831-1.0099036.json
- JSON-LD: 831-1.0099036-ld.json
- RDF/XML (Pretty): 831-1.0099036-rdf.xml
- RDF/JSON: 831-1.0099036-rdf.json
- Turtle: 831-1.0099036-turtle.txt
- N-Triples: 831-1.0099036-rdf-ntriples.txt
- Original Record: 831-1.0099036-source.json
- Full Text
- 831-1.0099036-fulltext.txt
- Citation
- 831-1.0099036.ris
Full Text
Cite
Citation Scheme:
Usage Statistics
Share
Embed
Customize your widget with the following options, then copy and paste the code below into the HTML
of your page to embed this item in your website.
<div id="ubcOpenCollectionsWidgetDisplay">
<script id="ubcOpenCollectionsWidget"
src="{[{embed.src}]}"
data-item="{[{embed.item}]}"
data-collection="{[{embed.collection}]}"
data-metadata="{[{embed.showMetadata}]}"
data-width="{[{embed.width}]}"
async >
</script>
</div>
Our image viewer uses the IIIF 2.0 standard.
To load this item in other compatible viewers, use this url:
https://iiif.library.ubc.ca/presentation/dsp.831.1-0099036/manifest