Hey @nirgrahamuk and @pieterjanvc thanks for input. Here are two responses.
(1) see reprex below.
(2) could you be a bit more specific about WHERE to use this options(scipen)?
I tried this but R returned "NULL". But perhaps I'm stupid, I dont know what this scipen means?
Thx, Scott
suppressPackageStartupMessages({
library(sjPlot)
library(ggeffects)})
# create ex. data set. 1 row per respondent (dataset shows 2 resp).
cedata.1 <- data.frame( id = c(1,1,1,1,1,1,2,2,2,2,2,2),
QES = c(1,1,2,2,3,3,1,1,2,2,3,3), # Choice set
Alt = c(1,2,1,2,1,2,1,2,1,2,1,2), # Alt 1 or Alt 2 in choice set
LOC = c(0,0,1,1,0,1,0,1,1,0,0,1), # attribute. binary categorical variable
SIZE = c(1,1,1,0,0,1,0,0,1,1,0,1), # attribute. binary categorical variable
Choice = c(0,1,1,0,1,0,0,1,0,1,0,1), # if Chosen (1) or not (0)
gender = c(1,1,1,1,1,1,0,0,0,0,0,0)
)
# convert to factor as required by sjPlot
cedata.1$Choice <- as.factor(cedata.1$Choice)
cedata.1$LOC <- as.factor(cedata.1$LOC)
cedata.1$SIZE <- as.factor(cedata.1$SIZE)
# estimate model
glm.model <- glm(Choice ~ LOC*SIZE, data=cedata.1, family = binomial(link = "logit"))
# estimate change in Pred Prob for the Interaction
LOC.SIZE <- ggpredict(glm.model, terms = c("LOC", "SIZE"))
LOC.SIZE
#>
#> # Predicted probabilities of Choice
#> # x = LOC
#>
#> # SIZE = 0
#>
#> x | Predicted | SE | 95% CI
#> -----------------------------------
#> 0 | 0.33 | 1.22 | [0.04, 0.85]
#> 1 | 0.50 | 1.41 | [0.06, 0.94]
#>
#> # SIZE = 1
#>
#> x | Predicted | SE | 95% CI
#> -----------------------------------
#> 0 | 0.67 | 1.22 | [0.15, 0.96]
#> 1 | 0.50 | 1.00 | [0.12, 0.88]
#> Standard errors are on the link-scale (untransformed).
# plot interaction
plot(LOC.SIZE, connect.lines = TRUE)

plot(COMP.DIST) + options(scipen = 999)