You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, the value of the intercept is 0.733. We can use the plogis() logistic function to convert it to a probability.
Converted, the intercept is about 0.67.
This means that the model predicts a 67 percent baseline chance of a positive outcome. This is what we would expect if x1 and x2 were at their average values.
-> But, when I predict the model with average value of predictor variable, it is different from intercept. Followings are reproducible example.
Hello, [in case some people get to this (late) as I did]
I noticed the same thing and suspect that the solution might not be correct. The intercept would give the fitted value for the mean predictor variables only if the predictors were centered before running the analysis.
library(mgcv)
csale <- readRDS("csale.rds")
# Examine the predictor and centre it
mean(csale$mortgage_age)
csale$cmortgage_age <- csale$mortgage_age - mean(csale$mortgage_age)
137.821795060209
# Fit a logistic model
log_mod <- gam(purchase ~ cmortgage_age, data = csale,
family = binomial,
method = "REML")
# Calculate the probability at the mean
plogis(coef(log_mod)[1])
plogis(predict(log_mod, newdata = data.frame(cmortgage_age = mean(csale$cmortgage_age))))
Here, the value of the intercept is 0.733. We can use the plogis() logistic function to convert it to a probability.
Converted, the intercept is about 0.67.
This means that the model predicts a 67 percent baseline chance of a positive outcome. This is what we would expect if x1 and x2 were at their average values.
-> But, when I predict the model with average value of predictor variable, it is different from intercept. Followings are reproducible example.
(Intercept)
-1.593984
-1.194276
The text was updated successfully, but these errors were encountered: