if (FALSE) { # require("emmeans", quietly = TRUE)
library(modelbased)
# Frequentist models
# -------------------
model <- lm(Petal.Length ~ Sepal.Width * Species, data = iris)
estimate_means(model)
estimate_means(model, fixed = "Sepal.Width")
estimate_means(model, by = c("Species", "Sepal.Width"), length = 2)
estimate_means(model, by = "Species=c('versicolor', 'setosa')")
estimate_means(model, by = "Sepal.Width=c(2, 4)")
estimate_means(model, by = c("Species", "Sepal.Width=0"))
estimate_means(model, by = "Sepal.Width", length = 5)
estimate_means(model, by = "Sepal.Width=c(2, 4)")
# Methods that can be applied to it:
means <- estimate_means(model, fixed = "Sepal.Width")
}
if (FALSE) { # require("see") && require("emmeans", quietly = TRUE)
plot(means) # which runs visualisation_recipe()
standardize(means)
}
if (FALSE) { # require("lme4") && require("emmeans", quietly = TRUE)
# \donttest{
data <- iris
data$Petal.Length_factor <- ifelse(data$Petal.Length < 4.2, "A", "B")
model <- lmer(Petal.Length ~ Sepal.Width + Species + (1 | Petal.Length_factor), data = data)
estimate_means(model)
estimate_means(model, by = "Sepal.Width", length = 3)
# }
}
Run the code above in your browser using DataLab