Download presentation
Presentation is loading. Please wait.
Published byGrace Durant Modified over 10 years ago
1
1 What you've always wanted to know about logistic regression analysis, but were afraid to ask... Februari, 1 2010 Gerrit Rooks Sociology of Innovation Innovation Sciences & Industrial Engineering Phone: 5509 email: g.rooks@tue.nl
2
This Lecture Why logistic regression analysis? The logistic regression model Estimation Goodness of fit An example 2
3
3 What's the difference between 'normal' regression and logistic regression? Regression analysis: –Relate one or more independent (predictor) variables to a dependent (outcome) variable
4
4 What's the difference between 'normal' regression and logistic regression? Often you will be confronted with outcome variables that are dichotomic: –success vs failure –employed vs unemployed –promoted or not –sick or healthy –pass or fail an exam
5
5 Example Relationship between hours studied for exam and success Hours# Failed exam # Passed exam? Total # students Prob. pass exam 28426.33 29325.40 30279.78 31279.78 3241620.80 3311415.93
6
6 Linear regression analysis Why is this wrong?
7
7 Logistic Regression The better alternative
8
8
9
9 The logistic regression equation predicting probabilities predicted probability (always between 0 and 1) similar to regression analysis
10
10 The Logistic function Sometimes authors rearrange the model or also
11
11 How do we estimate coefficients? Maximum-likelihood estimation Parameters are estimated by `fitting' models, based on the available predictors, to the observed data The chosen model fits the data best, i.e. is closest to the data Fit is determined by the so-called log likelihood statistic
12
12 Maximum likelihood estimation The log-likelihood statistic Large values of LL indicate poor fit of the model HOWEVER, THIS STATISTIC CANNOT BE USED TO EVALUATE THE FIT OF A SINGLE MODEL
13
13 Quantity of Study HoursOutcome 30 341 170 60 120 151 261 291 An example to illustrate maximum likelihood and the log likelihood statistic Suppose we know hours spent studying and the outcome of an exam
14
14 Quantity of Study HoursOutcome Predicted probability (b 0 =0; b 1 = 0.05) Predicted probability (b 0 =-6.44; b 1 = 0.39) 30.53.01 341.85.99 170.71.53 60.57.02 120.65.14 151.68.34 261.79.97 291.81.99 In ML different values for the parameters are `tried' Lets look at two possibilities: 1; b 0 = 0 & b 1 = 0.05; 2, b 0 = 0 & b 1 = 0.05
15
15 Quantity of Study HoursOutcome Predicted probability (b0=0; b1 = 0.05) LL (b0=0; b1 = 0.05) 30.53-.75 341.85-.16 170.71-1.24 60.57-.84 120.65-1.05 151.68-.39 261.79-.24 291.81-.21 We are now able to calculate the log likelihood statistic
16
16 Outcome Pr (b0=0; b1 = 0.05) LL (b0=0; b1 = 0.05) Pr (b0=-6.44; b1 = 0.39) LL (b0=-6.44; b1 = 0.39) 0.53-.75.01-.01 1.85-.16.99-.01 0.71-1.24.53-.75 0.57-.84.02-.02 0.65-1.05.14-.15 1.68-.39.34-1.08 1.79-.24.97-.03 1.81-.21.99-.01 -4.88-2.07 Two models and their log likelihood statistic Based on a clever algorithm the model with the best fit (LL closest to 0) is chosen
17
17 After estimation How do I determine significance? Obviously SPSS does all the work for you How to interpret output of SPSS Two major issues 1.Overall model fit –Between model comparisons –Pseudo R-square –Predictive accuracy / classification test 2.Coefficients –Wald test –Likelihood ratio test –Odds ratios
18
18 Model fit: Between model comparison The log-likelihood ratio test statistic can be used to test the fit of a model The test statistic has a chi-square distribution Model fit reduced model Model fit full model
19
19 Model fit The log-likelihood ratio test statistic can be used to test the fit of a model Model fit reduced modelModel fit full model
20
Between model comparison Estimate a null model Baseline model Estimate an improved model This model contains more variables Assess the difference in - 2LL between the models This difference follows a chi-square distribution degrees of freedom = # estimated parameters in proposed model – # estimated parameters in null model 20 Model fit reduced model Model fit full model
21
21 Overall model fit R and R 2 R2 in multiple regression is a measure of the variance explained by the model SS due to regression Total SS
22
22 Overall model fit pseudo R 2 Just like in multiple regression, logit R 2 ranges 0.0 to 1.0 –Cox and Snell cannot theoretically reach 1 –Nagelkerke adjusted so that it can reach 1 log-likelihood of model before any predictors were entered log-likelihood of the model that you want to test NOTE: R2 in logistic regression tends to be (even) smaller than in multiple regression
23
23 What is a small or large R and R 2 ? Strength of correlation Small0.10 to 0.29 Medium0.30 to 0.49 Large0.50 to 1.00
24
24 Overall model fit Classification table How well does the model predict outcomes? This means that we assume that if our model predicts that a player will score with a probability of.51 (above.5) the prediction will be a score (lower than.50 is a miss). spss output
25
25 Testing significance of coefficients The Wald statistic: not really good In linear regression analysis this statistic is used to test significance In logistic regression something similar exists however, when b is large, standard error tends to become inflated, hence underestimation (Type II errors are more likely) t-distribution standard error of estimate estimate
26
26 Likelihood ratio test an alternative way to test significance of a coefficient To avoid type II errors for some variables you best use the Likelihood ratio test model with variablemodel without variable
27
27 Before we go to the example A recap Logistic regression –dichotomous outcome –logistic function –log-likelihood / maximum likelihood Model fit –likelihood ratio test (compare LL of models) –Pseudo R-square –Classification table –Wald test
28
28 Illustration with SPSS Penalty kicks data, variables: –Scored: outcome variable, 0 = penalty missed, and 1 = penalty scored –Pswq: degree to which a player worries –Previous: percentage of penalties scored by a particulare player in their career
29
29 SPSS OUTPUT Logistic Regression Tells you something about the number of observations and missings
30
30 Block 0: Beginning Block this table is based on the empty model, i.e. only the constant in the model these variables will be entered in the model later on
31
31 Block 1: Method = Enter Block is useful to check significance of individual coefficients, see Field New model this is the test statistic after dividing by -2 Note: Nagelkerke is larger than Cox
32
32 Block 1: Method = Enter (Continued) Predictive accuracy has improved (was 53%) estimates standard error estimates significance based on Wald statistic change in odds
33
33 How is the classification table constructed? oops wrong prediction
34
34 How is the classification table constructed? pswqpreviousscoredPredict. prob. 18561.68 17351.41 20450.40 10420.85
35
35 How is the classification table constructed? pswqprevio us scoredPredict. prob. predict ed 18561.681 17351.410 20450.400 10420.851
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.