March 2019
Beginner to intermediate
448 pages
13h 14m
English
In this recipe, we will investigate how robust logistic regression handles extreme observations. The mechanics will be the same that we implemented for robust linear regression (we will generate data, contaminate it, and see how our estimates change).
library(robust)
set.seed(1000)x1 = rnorm(1000) x2 = rnorm(1000)link_val = 2 + 2*x1 + 5*x2 pr = 1/(1+exp(-link_val)) y = rbinom(1000,1,pr) df = data.frame(y=y,x1=x1,x2=x2)glm(y~x1+x2,data=df,family="binomial")robust::glmRob(y~x1+x2,data=df,family="binomial") ...
Read now
Unlock full access