31.2.1 section issue
Closed this issue · 1 comments
FernandoBorea commented
Hey, I noticed that on the last part of the 31.2.1 section the code shown to compare the estimates uses the object tmp which its not created so I'm unable to recreate the plot. Here's the part:
The resulting predictions are similar. This is because the two estimates of p(x) are larger than 1/2 in about the same region of x:
data.frame(x = seq(min(tmp$x), max(tmp$x))) %>%
mutate(logistic = plogis(glm_fit$coef[1] + glm_fit$coef[2]*x),
regression = lm_fit$coef[1] + lm_fit$coef[2]*x) %>%
gather(method, p_x, -x) %>%
ggplot(aes(x, p_x, color = method)) +
geom_line() +
geom_hline(yintercept = 0.5, lty = 5)
`> data.frame(x = seq(min(tmp$x), max(tmp$x))) %>%
-
mutate(logistic = plogis(glm_fit$coef[1] + glm_fit$coef[2]*x),
-
regression = lm_fit$coef[1] + lm_fit$coef[2]*x) %>%
-
gather(method, p_x, -x) %>%
-
ggplot(aes(x, p_x, color = method)) +
-
geom_line() +
-
geom_hline(yintercept = 0.5, lty = 5)
Error in seq(min(tmp$x), max(tmp$x)) : object 'tmp' not found`
rafalab commented
I think is fixed now. Let me know if not.