Безусловно, самой сложной частью ответа на этот вопрос было воссоздание ваших данных, чтобы сделать их воспроизводимыми. Однако примерно следующее:
library(jtools)
library(carData)
library(effects)
library(sjPlot)
library(lme4)
set.seed(69)
Behavioural.Activity <- factor(sample(c("Cleaning", "Courtship",
"Cruising", "Feeding"),
size = 10000,
replace = TRUE))
Maturity.Status <- factor(sample(LETTERS[1:3], 10000, TRUE))
ID.Number <- factor(sample(500, 10000, TRUE))
Golden.Trevally <- rbinom(10000, 1, prob =
(c(6, 4, 7, 3)/600)[as.numeric(Behavioural.Activity)] *
c(0.8, 1, 1.2)[as.numeric(Maturity.Status)] *
(as.numeric(ID.Number) / 1000 + 0.75))
mydf2 <- data.frame(ID.Number, Golden.Trevally,
Behavioural.Activity, Maturity.Status)
mod <- glmer(Golden.Trevally ~ Maturity.Status + Behavioural.Activity + (1 | ID.Number),
family = "binomial", data = mydf2)
my_sjplot <- plot_model(mod, "pred", title = "")
my_sjplot$Behavioural.Activity
The solution here is to realize that the object returned by plot_model
is a list containing two ggplot
objects. You are seeing the one for Behavioural.Activity
. It looks the way it does because it has a scale_y_continuous
whose labelling function is labelling the breaks to the nearest percent. You can simply over-ride this scale with one of your own:
my_sjplot$Behavioural.Activity +
scale_y_continuous(limits = c(0, 0.01),
labels = scales::percent_format(accuracy = 0.01))
введите описание изображения здесь