Neas-Seminars

MS Mod 15: Linear and logistic regression models – practice problems


http://33771.hs2.instantasp.net/Topic15880.aspx

By NEAS - 6/24/2018 3:05:39 PM


MS Module 15: Linear and logistic regression models – practice problems

(The attached PDF file has better formatting.)

Exercise 15.1: Logistic regression

A probability Y is related to the independent variable X by logistic regression:

    Y = p(x) = exp(β0 + β1 x) / (1 + exp(β0 + β1 x) )

●    When X = 7, the probability Y is 20%.
●    When X = 8, the probability Y is 25%.

A.    At X = 7, what is the odds ratio of Y?
B.    At X = 8, what is the odds ratio of Y?
C.    At X = 11, what is the odds ratio of Y?
D.    At X = 11, what is the probability of Y?

Part A: The odds ratio of Y at x = 7 is 20% / (1 – 20%) = 0.2500.

Part B: The odds ratio of Y at x = 8 is 25% / (1 – 25%) = 0.3333.

Part C: The slope parameter β1 is the change in the log odds for a 1-unit increase in x, so the odds ratio itself changes by the multiplicative factor exp(β1) when x increases by 1 unit. This factor is

    0.333333 / 0.25 = 1.33333

11 is 3 units more than 8, so the odds ratio of Y at x = 11 is 0.333333 × 1.3333333 = 0.79012

Part D: If Y = the probability and R = the odds ratio, R = Y / (1–Y) ➾ Y = R / (1+R).

The probability is the odds ratio / (1 + odds ratio), so the probability of Y at x = 11 is

    0.79012 / 1.79012 = 44.14%

Exercise 15.2: Logistic regression

A statistician uses a logistic regression model:

●    The independent variable X is a quantitative predictor.
●    The dependent variable Y is 1 if the observation is a success and 0 otherwise.

The estimate of β1 is –0.20.

The odds of success at X = 1 are 50%.

A.    What is the probability of success at X = 1?
B.    What are the odds of success at X = 3?
C.    What is the probability of success at X = 3?
D.    What are the odds of success at X = 0?
E.    What is the probability of success at X = 0?
F.    What is β0?

Part A: If the probability of success is P, the odds of success are P/(1-P).

Given that P/(1-P) = 50%, P = ½ – ½P ➾ P = ⅓.

The formula is probability = odds / (1 + odds) = 50% / (1 + 50%) = 0.3333

Part B: For each one unit increase in X, the odds of success increase by a factor exp(1) = e–0.20 = 0.81873

3 is 2 units more than 1, so the odds of success at X = 3 are 50% × 0.818732 = 0.335159

Part C: P/(1-P) = 0.33516 ➾ 1.33516 P = 0.33516 ➾ P = 0.33516 / 1.33516 = 0.25103

Part D: 0 is 1 unit less than 1, so the odds of success at X = 0 are 50% / 0.81873 = 0.610702

Part E: The probability of success at X = 0 is 0.610702 / 1.610702 = 0.379153

Part F: For logistic regression, Y = exp(β0) / (1 + exp(β0 + β1 × X) ).

If Y = 0.379153 at X = 0, then exp(β0) / (1 + exp(β0) ) = 0.379153 ➾

(1 – 0.379153) × exp(β0) = 0.379153 ➾

exp(β0) = 0.379153 / (1 – 0.379153) = 0.610703

β0 = ln(0.610703) = –0.49314