Multilevel Binary Logistic Regression
-
Upload
economic-research-forum -
Category
Government & Nonprofit
-
view
586 -
download
2
Transcript of Multilevel Binary Logistic Regression
![Page 1: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/1.jpg)
Eduard Ponarin Veronica Kostenko
Boris Sokolov
Multilevel binary logistic regression
Lecture 3
![Page 2: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/2.jpg)
The basic logistic regression
• X on Y in case of a binary outcome.
• For example, if a candidate won or not during the elections, Y is either 0 or 1). Here X stands for the money spent on the campaign, Y – the outcome.
![Page 3: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/3.jpg)
Plotting X against proportion of successes
Where ni stands for the number of observations at X = h.
![Page 4: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/4.jpg)
Why not a linear model for probabilities?
• Linear approximation is problematic in this case because:
a) Residuals are non-randomly distributed
b) 0.2 < p < 0.8 is distributed otherwise then the tails of the function (p < 0.2; p > 0.8)
c) Regression line should fall into the interval between 0 and 1 which is hard to fit for a linear model
• Estimated probabilities should be transformed into logits
![Page 5: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/5.jpg)
Transformation of probabilities into logits
![Page 6: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/6.jpg)
Plotting logit functions
Increasing logit function Decreasing logit function
![Page 7: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/7.jpg)
Plotting probabilities for a single level logistic regression
![Page 8: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/8.jpg)
Multilevel logistic regression formula
logit (Pr (Yi=1)) = αj + εi = γ00 + η0j + εi
logit (Pr (Yi=1)) = αj + βgender * gender + βage * age + εi.
αj = γ00 + η0j
![Page 9: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/9.jpg)
Script for a simple model
• M1 <- glmer(y ~ female + age + (1|country), family=binomial(link="logit"))
• display (M1)
![Page 10: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/10.jpg)
Output for a logistic multilevel regression
• Coefficients shouldn’t be interpreted as in linear models, they should be transformed (exponential or divided-by-4 rule)
• Signs of the coefficients stay the same
• Coefficients can be compared with each other
![Page 11: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/11.jpg)
Output for a simple model
![Page 12: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/12.jpg)
Summary (more informative)
![Page 13: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/13.jpg)
Adding 1st level interaction
• M2 <- glmer (relig ~ age + gender +
age: gender + (1|country), family = binomial(link = "logit"))
• display (M2)
• summary(M2)
![Page 14: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/14.jpg)
Summary with interaction
![Page 15: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/15.jpg)
Varying intercepts and slopes without group – level predictor
• M3 <- glmer (relig ~ gender + age + (1 + gender|country), family = binomial(link = "logit"))
• summary (M3)
![Page 16: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/16.jpg)
Summary with varying slope
![Page 17: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/17.jpg)
Adding a group-level predictor
• M4 <- glmer (relig ~ gender +
+ gdp + (1+ gender|country), family = binomial(link = "logit"))
• display (M4)
• summary(M4)
![Page 18: Multilevel Binary Logistic Regression](https://reader033.fdocuments.in/reader033/viewer/2022051503/586fdf6f1a28ab18428b6ffb/html5/thumbnails/18.jpg)
A model with between-level interaction