Upcoming SlideShare
×

# Final generalized linear modeling by idrees waris iugc

1,781 views
1,618 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

• Be the first to like this

Views
Total views
1,781
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
34
0
Likes
0
Embeds 0
No embeds

No notes for slide
• Correlated or clustered dataThe standard GLM assumes that the observations are uncorrelated. Extensions have been developed to allow for correlation between observations, as occurs for example in longitudinal studies and clustered designs:Generalized estimating equations (GEEs) allow for the correlation between observations without the use of an explicit probability model for the origin of the correlations, so there is no explicit likelihood. They are suitable when the random effects and their variances are not of inherent interest, as they allow for the correlation without explaining its origin. The focus is on estimating the average response over the population (&quot;population-averaged&quot; effects) rather than the regression parameters that would enable prediction of the effect of changing one or more components of X on a given individual. GEEs are usually used in conjunction with Huber-White standard errors. [4][5]Generalized linear mixed models (GLMMs) are an extension to GLMs that includes random effects in the linear predictor, giving an explicit probability model that explains the origin of the correlations. The resulting &quot;subject-specific&quot; parameter estimates are suitable when the focus is on estimating the effect of changing one or more components of X on a given individual. GLMMs are a particular type of multilevel model (mixed model). In general, fitting GLMMs is more computationally complex and intensive than fitting GEEs.Hierarchical generalized linear models (HGLMs) are similar to GLMMs apart from two distinctions:The random effects can have any distribution in the exponential family, whereas current GLMMs nearly always have normal random effects;They are not as computationally intensive, as instead of integrating out the random effects they are based on a modified form of likelihood known as the hierarchical likelihood or h-likelihood.The theoretical basis and accuracy of the methods used in HGLMs have been the subject of some debate in the statistical literature. As of 2008, the method is only available in one statistical software package, namely
• Canonical means: conforming to a general rule reduced to the simplest or clearest scheme possible the simplest form of a matrix (specifically the form of a square matrix that has zero off-diagonals).
• AssumptionsNot assumed. GZLM/GEE, compared to GLM, do not assume a normally distributed dependent variable (or normally distributed independents), nor linearity between the predictors and the dependent, nor homogeneity of variance for the range of the dependent variable. Linearity of the link function. The researcher still must select a link function such that there is a linear relation between the linear predictor (the right-hand side of the model equation) and the link function of the dependent. For example, in logistic regression models, one must check to see if there is &quot;linearity in the logit,&quot; meaning the linear predictor is in fact linearly related to the logit of the dependent. Absence of high multicollinearity. As in other linear models, presence of high multicollinearity among the independents will inflate standard errors and confound interpretation of the relative contributions of the independents. Centered data. As in regression, centering may be necessary either to reduce multicollinearity or to make interpretation of coefficients meaningful. Centering is almost always recommended for independent variables which are components of interaction terms in a logistic model. Data distribution. The independents may be of any distribution so long as linearity of the link function is maintained. The dependent may assume any of a wide variety of distributions, including normal, inverse normal (inverse Gaussian), binomial, multinomial, and Poisson. Independent vs. correlated data . In GZLM, observations are assumed to be independent. In GEE, observations are assumed to be independent between subjects within any given time period, cluster, or repeated measures factor, but are assumed to be dependent within the same subject across repeated measures factors. That is, GEE assumes between-subjects independence and within-subjects dependence. In practical terms, if there are repeated measures, GEE, not GZLM, should be chosen and the repeated measures properly specified. Data levels. In both GZLM and GEE, the dependent (response) variable may be binary, counts, scale, or events-in-trials. &quot;Scale&quot; means interval or ordinal if it can be assumed that ordinal values represent ordered categories with a meaningful metric, so that distance comparisons between values are appropriate. For ordinal response variables, the model type should be multinomial (ordinal) logistic or ordinal probit. Factors are categorical. Covariates are scale variables. Weight and offset variables, if any, are also assumed to be scale. In GEE, the variables specified as repeated measures within-subjects effects, or the variables used to define subjects, cannot be used as dependent variables. Missing data. As in other forms of statistical analysis, missing data can lead to biased coefficients unless data are missing completely at random.
• Interpretation: There seems to be a Shopping style effect; on average, &quot;biweekly&quot; customers spend \$378.52, while &quot;weekly&quot; customers spend \$404.55, and &quot;often&quot; customers spend \$406.76. There also appears to be a Gender effect; on average, males in the sample spend \$430.30 compared to \$365.66 for females. Lastly, there may be an interaction effect between Gender and Shopping style, because the mean differences in amount spent by shopping style vary between genders. For example, &quot;biweekly&quot; male customers tend to spend more than &quot;often&quot; male customers, but this trend is reversed for &quot;biweekly&quot; and &quot;often&quot; female customers. The N column in the table shows there are unequal cell sizes. Most customers prefer to shop on a weekly basis. The standard deviations appear relatively homogenous, although you should check Levene&apos;s test and the spread-versus-level plots to be sure. Dependent variable Amount spent: This table tests the null hypothesis that the variance of the error term is constant across the cells defined by the combination of factor levelsSince the significance value of the test, 0.330, is greater than 0.10, there is no reason to believe that the equal variances assumption is violated. Thus, the small differences in group standard deviations observed in the descriptive statistics table are due to random variationThe spread-versus-level plot is a scatterplot of the cell means and standard deviations from the descriptive statistics tableIt provides a visual test of the equal variances assumption, with the added benefit of helping you to assess whether violations of the assumption are due to a relationship between the cell means and standard deviationsThere is no apparent pattern in this plot, so there is no indication of such a relationship here. The tests of between-subjects effects help you to determine the significance of a factor. However, they do not indicate how the levels of a factor differ. The post hoc tests show the differences in model-predicted means for each pair of factor levels. The first column displays the different post hoc testsThe next two columns display the pair of factor levels being tested. When the significance value for the difference in Amount spent for a pair of factor levels is less than 0.05, an asterisk (*) is printed by the differenceIn this case, there do not appear to be significant differences in the spending habits of &quot;biweekly&quot;, &quot;weekly&quot;, or &quot;often&quot; customers. Tamhane&apos;s T2 is generally more appropriate than Tukey&apos;s HSD when there are unequal cell sizes, but the results in this case are largely the sameThe confidence intervals for Tamhane&apos;s T2 are only slightly wider than those for Tukey&apos;s HSD. Since the results of these two tests are not very different, it is safe for you to look at the results of the homogenous subsets, which are available for Tukey&apos;s HSD but not for Tamhane&apos;s T2. The homogenous subsets table takes the results of the post hoc tests and shows them in a more easily interpretable formIn the subset columns the factor levels that do not have significantly different effects are displayed in the same columnIn this example, the first subset contains the &quot;biweekly&quot;, &quot;weekly&quot;, and &quot;often&quot; customers.  These are all the customers, so there are no other subsets.  The post hoc tests suggest that efforts at enticing customers to shop more often than usual is wasted because they will not spend significantly more. However, the post hoc test results do not account for the levels of other factors, thus ignoring the possibility of an interaction effect with Gender seen in the descriptive statistics table. See the estimated marginal means to see how this might change your conclusionsThis table displays the model-estimated marginal means and standard errors of Amount spent at the factor combinations of Gender and Shopping style. This table is useful for exploring the possible interaction effect between these two factorsIn this example, a male customer who makes purchases weekly is expected to spend about \$440.96, while one who makes purchases more often is expected to spend \$407.77. A female customer who makes purchases weekly is expected to spend \$361.72, while one who makes purchases more often is expected to spend \$405.72. Thus, there is a difference between &quot;weekly&quot; and &quot;often&quot; customers, depending upon the gender of the customer. This fact suggests an interaction effect between Gender and Shopping style. If there were no interaction, you would expect the difference between shopping styles to remain constant for male and female customers. The interaction can be seen more easily in the profile plotsThe profile plot is a visual representation of the marginal means table.The factor levels of Shopping style are shown along the horizontal axisSeparate lines are produced for each level of Gender.  Alternately, the factor levels of Gender could be shown along the horizontal axis, with separate lines produced for each level of Shopping style.  If there were no interaction effect, the lines in the table would be parallel. Instead, you can see that the difference in spending between &quot;weekly&quot; and &quot;often&quot; customers is greater for female customers, as the line for male customers slopes downward and that for female customers slopes upward.  This is a strong interaction effect and is unlikely to be due to chance, but you should check the tests of between-subjects effects for confirmation of its significanceThis is an analysis of variance table. Each term in the model, plus the model as a whole, is tested for its ability to account for variation in the dependent variable. Note that variable labels are not displayed in this table.  The significance value for each term, except STYLE, is less than 0.05. Therefore each term, except STYLE, is statistically significant.  The partial eta squared statistic reports the &quot;practical&quot; significance of each term, based upon the ratio of the variation (sum of squares) accounted for by the term, to the sum of the variation accounted for by the term and the variation left to error.Larger values of partial eta squared indicate a greater amount of variation accounted for by the model term, to a maximum of 1. Here the individual terms, while statistically significant, do not have great effect on the value of Amount spent.  The GLM Univariate procedure is useful for modeling the linear relationship between a dependent scale variable and one or more categorical and scale predictors. If you have only one factor, you can alternatively use the One-Way ANOVA procedure. If you only have covariates, use the Linear Regression procedure for more model-building, residual-checking, and output options
• 15 custom Link functionsIdentity. f(x)=x. The dependent variable is not transformed. This link can be used with any distribution.• Complementary log-log. f(x)=log(−log(1−x)). This is appropriate only with the binomial distribution.• Cumulative Cauchit. f(x) = tan(π (x – 0.5)), applied to the cumulative probability of each category of the response. This is appropriate only with the multinomial distribution.• Cumulative complementary log-log. f(x)=ln(−ln(1−x)), applied to the cumulative probability of each category of the response. This is appropriate only with the multinomial distribution.• Cumulative logit. f(x)=ln(x / (1−x)), applied to the cumulative probability of each category of the response. This is appropriate only with the multinomial distribution.• Cumulative negative log-log. f(x)=−ln(−ln(x)), applied to the cumulative probability of each category of the response. This is appropriate only with the multinomial distribution.• Cumulative probit. f(x)=Φ−1(x), applied to the cumulative probability of each category of the response, where Φ−1 is the inverse standard normal cumulative distribution function. This is appropriate only with the multinomial distribution.• Log. f(x)=log(x). This link can be used with any distribution.• Log complement. f(x)=log(1−x). This is appropriate only with the binomial distribution.• Logit. f(x)=log(x / (1−x)). This is appropriate only with the binomial distribution.• Negative binomial. f(x)=log(x / (x+k−1)), where k is the ancillary parameter of the negative binomial distribution. This is appropriate only with the negative binomial distribution.• Negative log-log. f(x)=−log(−log(x)). This is appropriate only with the binomial distribution.• Odds power. f(x)=[(x/(1−x))α−1]/α, if α ≠ 0. f(x)=log(x), if α=0. α is the required number specification and must be a real number. This is appropriate only with the binomial distribution.• Probit. f(x)=Φ−1(x), where Φ−1 is the inverse standard normal cumulative distribution function. This is appropriate only with the binomial distribution.• Power. f(x)=xα, if α ≠ 0. f(x)=log(x), if α=0. α is the required number specification and must be a real number. This link can be used with any distribution.
• ### Final generalized linear modeling by idrees waris iugc

1. 1. NAME : IDREES WARIS <br />REG NO: 3095<br />SEMESTER : 4TH<br />COURSE : QTIA <br />COURSE FACILITATOR: SIR IMTIAZ ARIF<br />1<br />GENERALIZED LINEAR MODEL<br />
2. 2. MAIN POINTS TO BE DISCUSSED IN GZLM<br />2<br />What is GZLM or GRZ and why to use GZLM(History and Explanation)<br />When to use GZLM (Assumptions)<br />How to use GZLM in SPSS (Statistical Procedure)<br />
3. 3. What is Generalized linear model (GZLM)?<br />3<br />The Generalized Linear Model is a generalization of the general linear model (GLM) discussed separately with regard to Anova/Ancova andManova/Mancova models, as well as regression models. <br />GZLM allows for dependent variables with non-normal distributions and for many link functions other than identity. <br />GZLM supports not only traditional regression models but also logistic models for binary dependents, log-linear analysis of count data, Poisson regression for count data, gamma regression, complementary log-log models for interval-censored survival data, and many others. <br />
4. 4. HISTORY<br />4<br />Generalized Linear Model was first discussed by John Nelder and Robert Wedderbun in 1972 in an article.<br />You may find its overview in article by Gill (2001)<br />
5. 5. Difference between General linear model(GLM) and Generalized linear model(GZLM)<br />5<br />General linear model (GLM) <br />The general linear model (GLM) is a flexible statistical model that incorporates normally distributed dependent variables and categorical or continuous independent variables.<br />GLM enables you to accommodate designs with empty cells, more readily interpret the results using profile plots of estimated means, and customize the linear model so that it directly addresses the research questions you ask.<br />Anyone who regularly fits linear models, whether univariate, multivariate or repeated measures, will find the GLM procedure to be very useful.<br />General Equation: Y= b + b₁X₁ + b₂X₂ +………+ bkXk + ℮<br />
6. 6. GZLM Extensions:<br />6<br />Correlated or clustered data:<br />Generalized Estimating Equations (GEEs)<br />Generalized Linear mixed Models (GLMMs)<br />Hierarchical generalized linear models<br /> (HGLMs)<br />Generalized additive models (GAMs)<br />
7. 7. Components of GZLM<br />7<br />There are 3 components of a generalized linear model<br /> (or GLM):<br />1. Random Component — identify the response variable (Y ) andspecify/assume a probability distribution for it.<br />2. Systematic Component — specify what the explanatory or predictor variables are (e.g., X1, X2, etc). These variable enter in a linear manner α + β1X1 + β2X2 + . . . + βkXk<br />3. Link Function— Specify the relationship between the mean or expected value of the random component<br /> (i.e., E(Y )) and the systematic component.<br />
8. 8. Random ComponentLet N = sample size and suppose that we have Y1, Y2, . . . , YN observations on our response variable and that the observations are all independent. Y ’s that are discrete variables where Y is either<br />8<br />Counts (including cells of a contingency table):<br />Number of people who die from AIDS during a given time period.<br />Number of times a child tries to take a toy away from another child.<br />Number of times patents generated by firms.<br />These responses have a Poisson distribution.<br />Dichotomous (binary) with a fixed numbers of trials.<br />success/failure<br />correct/incorrect<br />agree/disagree<br />academic/non-academic program<br />These responses have a Binomial distribution.<br />
9. 9. Systematic Component<br />9<br />As in ordinary regression, we were modeling means. The focus is on the expected value of our response variable<br />E(Y ) = μ<br />We want to investigate whether and how μ varies as a function of the levels of our predictor or explanatory variables, X’s.<br />The systematic component of the model consists of a set of explanatory variables and some linear function of them.<br />βo + β1x1 + β2x2 + β3x3 + . . . + βkxk.<br />This linear combination of our explanatory variables is referred to as a “linear predictor”. This part of the model is very much like what you know with respect to ordinary linear regression<br />
10. 10. The Link Function<br />10<br />“Left hand” side of an equation/model — the random component; that is,<br />E(Y ) = μ<br />“Right hand” side of the equation — the systematic component; that is,<br />α + β1x1 + β2x2 + . . . + βkxk<br />We now need to “link” the two sides.<br />How is μ = E(Y ) related to α + β1x1 + β2x2 + . . . + βkxk?<br />We do this using a “Link Function” =) g(μ)<br />g(μ) = α + β1x1 + β2x2 + . . . + βkxk<br />
11. 11. More about the Link Function<br />11<br />The link function provides the relationship between the linear predictor and the mean of the distribution function. <br />Important things about g(.):<br />This function g(.) is “monotone” — as the systematic part gets larger, μ gets larger (or smaller).<br />The relationship between E(Y ) and the systematic part can be non-linear.<br />Some common links are:<br />1. Identity(ordinary regression, ANOVA, ANCOVA): <br />E(Y ) = α + βx<br />2. Log link which is often used when Y is nonnegative (i.e., 0 Y ): <br />log(E(Y )) = log(μ) = α + βx<br />This yields a “loglinear” model. <br />3. Logit link, which is often used when 0 μ 1 (e.g., when response is <br />dichotomous/binary and we’re interested in a probability).<br />log(μ/(1 − μ)) = α + βx<br />
12. 12. Link FunctionThe Canonical links<br />12<br />
13. 13. When? (ASSUMPTIONS)<br />13<br />Not assumed. GZLM/GEE, compared to GLM, do not assume a normally distributed dependent variable (or normally distributed independents), nor linearity between the predictors and the dependent, nor homogeneity of variance for the range of the dependent variable. <br />Linearity of the link function.<br />Absence of high multicollinearity<br />Centered data<br />Data distribution<br />Independent vs. correlated data<br />Data levels<br />Missing data<br />
14. 14. How to run GZLM in SPSS<br />14<br />Model Types (Already given Common model types)<br />Scale Response. <br />Linear. Specifies Normal as the distribution and Identity as the link function. <br />Gamma with log link. Specifies Gamma as the distribution and Log as the link function. <br />Ordinal Response. <br />Ordinal logistic. Specifies Multinomial (ordinal) as the distribution and Cumulative logit as the link function. <br />Ordinal probit. Specifies Multinomial (ordinal) as the distribution and Cumulative probit as the link function. <br />Counts. <br />Poisson loglinear. Specifies Poisson as the distribution and Log as the link function. <br />Negative binomial with log link. Specifies Negative binomial (with a value of 1 for the ancillary parameter) as the distribution and Log as the link function. To have the procedure estimate the value of the ancillary parameter, specify a custom model with Negative binomial distribution and select Estimate value in the Parameter group.<br />
15. 15. 15<br />Model Types continued…<br />Binary Response or Events/Trials Data. <br />Binary logistic. Specifies Binomial as the distribution and Logit as the link function.<br />Binary probit. Specifies Binomial as the distribution and Probit as the link function.<br />Interval censored survival. Specifies Binomial as the distribution and Complementary log-log as the link function.<br />Mixture. <br />Tweedie with log link. Specifies Tweedie as the distribution and Log as the link function.<br />Tweedie with identity link. Specifies Tweedie as the distribution and Identity as the link function.<br />Custom. Specify your own combination of distribution and link function.<br />
16. 16. 16<br />Model Types (8 Custom distributions)<br />Normal<br />Inverse Gaussian<br />Gamma<br />Multinomial<br />Binomial<br />Poisson<br />Negative Binomial<br />Tweedie<br />
17. 17. DISTRIBUTIONS<br />Normal<br />Inverse Gaussian<br />17<br />
18. 18. DISTRIBUTIONS<br />Gamma<br />Binomial<br />18<br />
19. 19. DISTRIBUTIONS<br />Poisson<br />Negative Binomial<br />19<br />
20. 20. Distributions<br />20<br />Tweedie<br />Tweedie distribution requires a parameter, p, which the researcher enters to determine the shape of the distribution:<br />p=0: normal distribution<br />p=1: Poisson distribution<br />1< p< 2: for continuous data with exact zeros (the default in SPSS is 1.5)<br />p=2: gamma distribution<br />p>2: for positive continuous data<br />Multinomial<br />Dependent has a finite number of categories, has text string values, or is ordinal. <br />The distribution among categories, not shown, is arbitrary. <br />
21. 21. 15 custom Link functions<br />21<br />Normal, Gamma, Inverse Gaussian, Poisson and Twedie distributions:<br />Identity<br />Log<br />Power<br />
22. 22. 22<br />Negative binomial distributions <br />Negative binomial<br />Binomial distributions <br />Logit<br />Probit<br />Complementary log-log<br />Negative log <br />Log complement<br />Odds power<br />Multinomial distributions <br />Cumulative logit<br />Cumulative Probit<br />Cumulative Cauchit<br />Cumulative Complementary log <br />Cumulative negative log <br />
23. 23. Data for Analysis<br />23<br />Take data from SPSS 18.0 sample files of ships data sav.<br />To study the effect of <br />Ships type<br />Year of Construction &<br />Period of Operation on<br />No. of damage incidents<br />To run a Generalized Linear Models analysis, from the menus choose:<br /> Analyze   Generalized Linear Models     Generalized Linear Models...<br />
24. 24. 24<br /> Analyze  Generalized Linear Models   Generalized Linear Models...<br />Type of Model Tab (specify DV distribution and link function)<br /> On the Response tab, select a dependent variable.<br /> On the Predictors tab, select factors and covariates for use in predicting the dependent variable. (Factors are categorical predictors; they can be numeric or string and Covariates are scale predictors; they must be numeric)<br /> On the Model tab, specify model effects using the selected factors and covariates.<br />Estimation<br />Statistics<br />EM means<br />Save<br />Export<br />
25. 25. 25<br />Type of model tab will appear:<br />Select Poisson log-linear as the type of model. This specifies a Poisson distribution with a log link function.<br />Click the Response tab:<br />Select Number of damage incidents as the dependent variable.<br />Click the Predictors tab:<br />Select Ship type, Year of construction, and Period of operation as factors.<br />Select Logarithm of aggregate months of service as the offset.<br />Click Options. Select Descending as the category order for factors<br />Click Continue<br />Click OK<br />
26. 26. 26<br />Click the Model tab<br />Select type (Ship type), construction (Year of construction), and operation (Period of operation) as main effects in the model.<br />Click the Estimation tab.<br />Select Pearson chi-square as the method for estimating the scale parameter.<br />Click the EM Means tab<br />Select type (Ship type) and construction (Year of construction) as terms to display means for and select Pairwise as the contrast for each.<br />Select Compute means for linear predictor as the scale.<br /> Select Sequential Sidak as the adjustment method.<br />Click the Save tab.<br />Select Predicted value of linear predictor and Standardized deviance residual. These values are saved to the active dataset and can help you diagnose any problems with the model fit.<br />
27. 27. Scatter Plot<br />27<br />To produce a scatter plot of Standardized Deviance Residual by Predicted Value of the Linear Predictor, from the menus choose:<br />  Graphs    Chart Builder...<br />Select the Scatter/Dot gallery and choose Simple Scatter.<br />Select Standardized Deviance Residual as the y variable and Predicted Value of the Linear Predictor as the x variable.<br />Click OK.<br />
28. 28. Research Papers and Thesis for Understanding<br />28<br />Development of an Accident Prediction Model using GLIM (Generalized Log-linear Model) and EB method: A case of Seoul (Korea)<br />Log-Linear Models by Noah A. Smith<br />Fitting Tweedie’s Compound Poisson Model to Insurance Claims Data: Dispersion Modeling<br />On the Distribution of Discounted Loss Reserves Using Generalized Linear Models by Gordon K. Smyth (December 2001)<br />The application of over dispersion and (GEE) Generalized Estimating Equations in repeated categorical data ( for understanding over dispersion, Poisson, negative binomial and GEE)<br />Clustering of foot-based pitch contours in expressive speech by Esther Klabbers and Jan P. H. van Santen<br />Collaborative filtering with interlaced generalized linear models by Nicolas Delannay, Michel Verleysen<br />DISSERTATION OF STANFORD UNIVERSITY GENERALIZED LINEAR MODELS WITH REGULARIZATION by Mee Young Park (September, 2006)<br />