[email protected] Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm...

8
Regression Analysis: Lab 10 Logistic Regression [email protected] Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help. Check out some regression videos www.khanacademy.org This presentation can be found at: www.mahritaharahap.wordpress.com/teaching-areas/ Marking Scheme: 0 if less than 50% attempted, 1 for more than 50% attempted but less than 50% correct, 2 if more than 50% correct.

Transcript of [email protected] Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm...

Page 1: Mahrita.Harahap@uts.edu.au Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help. Check out some regression videos.

Regression Analysis: Lab 10Logistic [email protected] advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help.Check out some regression videos www.khanacademy.org This presentation can be found at:www.mahritaharahap.wordpress.com/teaching-areas/

Marking Scheme: 0 if less than 50% attempted, 1 for more than 50% attempted but less than 50% correct, 2 if more than 50% correct.

Page 2: Mahrita.Harahap@uts.edu.au Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help. Check out some regression videos.

Introduction to Logistic Regressionyi=α+β1x1i+….+βpxpi+εi εi~N(0,σ)

When the response variable y is not a continuous random variable but a categorical random response variable, the normal linear regression model becomes inappropriate because the random errors are no longer normally distributed. Therefore, we need to use logistic regression, which deals with this type of data for the response variable. Suppose the response variable y takes only two possible values, 1 and 0 (to denote success or failure for example):Then p=P(y=1)=probability of belonging to group 1 (e.g. success group) so 1-p=P(y=0)=probability of belonging to group 0

In order to do regression on a categorical response variable, we need to do a transformation of p to the whole real line i.e. g:[0,1]->(-∞,∞), using a link function called logit link ), hence which is why this is called logistic regression.

Page 3: Mahrita.Harahap@uts.edu.au Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help. Check out some regression videos.

This is the transformation model:

and the inverse of the transformation model gives

which gives the logistic regression model:==probability of belonging to group 1

Page 4: Mahrita.Harahap@uts.edu.au Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help. Check out some regression videos.

Feedback for Lab 9

log (𝑜𝑑𝑑𝑠 )=𝜂=α+β1 x1 i ¿−48.909+1.313(𝐺𝐴𝐺𝐸)

Page 5: Mahrita.Harahap@uts.edu.au Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help. Check out some regression videos.

log (𝑜𝑑𝑑𝑠 )=𝜂=α+β1 x1 i=−1.033+0.835(𝑆𝐸𝑋 )

Page 6: Mahrita.Harahap@uts.edu.au Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help. Check out some regression videos.

Lab 10: Logistic Regression

Log odds scale interpretation: Odds scale interpretation: NOTE: Interpretation of odds is multiplicative (see slide 29 in lecture 10)

Hosmer and Lemeshow Test assesses the goodness of the model fit. (see slide 5 lec 11)Ho: Model fits well, so the observed probabilities will be close to what the model expects them to be.Ha: Model does not fit well, so the observed probabilities will NOT be close to what the model expects them to be. We might need to add additional variables…

Page 7: Mahrita.Harahap@uts.edu.au Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help. Check out some regression videos.

c)

Coding for health status

hlstat(1)

hlstat(2)

hlstat(3)

hlstat(4)

Odds

1 Excellent

1 0 0 0 e

2 Good 0 1 0 0 e

3 Average

0 0 1 0 e

4 Poor 0 0 0 1 e

5 Very Poor

0 0 0 0 Reference Category

Reference category

LOGISTIC REGRESSION MODEL:

DUMMY VARIABLE CODING TABLE: (this help you for interpretations)

Page 8: Mahrita.Harahap@uts.edu.au Take advantage of the Maths Study Centre CB01.16.11 Open 11am – 5pm Semester Weekdays for help. Check out some regression videos.

d)

LOGISTIC REGRESSION MODEL:(hgsex* )

(hgsex* )]

Remember what the coding represents!!!