'ggeffect() Not Returning all Predictions
Using the Seatbelts (included in R) data, I want the predictions for the marginal effect of "front". This variable has 170 values. ggeffect() is only returning predictions for front at the values 400, 500, 600, ...,1300. How can I return all of the predictions?
Seatbelts <- data.frame(Seatbelts)
head(Seatbelts)
Seatbelts <- Seatbelts[complete.cases(Seatbelts), ]
## 75% of the sample size
smp_size <- floor(0.75 * nrow(Seatbelts))
## set the seed to make your partition reproducible
set.seed(123)
train_ind <- sample(seq_len(nrow(Seatbelts)), size = smp_size)
train <- Seatbelts[train_ind, ]
test <- Seatbelts[-train_ind, ]
# glm()
m1 <- glm(DriversKilled ~ front + rear + kms + PetrolPrice +
VanKilled + law,
family=poisson(link = "log"),
weights = drivers,
data=train)
ggeffect(m1, terms = c("front"), typical = "average")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

