# NOT RUN {
data(mtcars)
m1 <- lm(mpg ~ vs + carb + hp + wt + wt * hp , data = mtcars)
plot_effect(reg.coef = summary(m1)$coefficients,
data = mtcars, model = m1,
x_var.name = "wt", y_var.name = "mpg", moderator.name = "hp",
confidence_interval = TRUE, CI_Ribbon = TRUE,
xlab = "Weight", ylab = "MPG", moderator.lab = "Horsepower")
# }
# NOT RUN {
#' @examples
# }
# NOT RUN {
data(mtcars)
m2 <- lm(mpg ~ vs + carb + hp + wt + wt * hp + wt * vs, data = mtcars)
plot_effect(reg.coef = summary(m2)$coefficients,
data = mtcars, model = m2,
x_var.name = "wt", y_var.name = "mpg", moderator.name = "hp",
confidence_interval = TRUE, CI_Ribbon = FALSE,
xlab = "Weight", ylab = "MPG", moderator.lab = "Horsepower")
# }
# NOT RUN {
#' @examples
# }
# NOT RUN {
data(mtcars)
m3 <- lm(mpg ~ vs + carb + hp + lspline(wt, knots = 4, marginal = FALSE) * hp, data = mtcars)
plot_effect(reg.coef=summary(m3)$coefficients,
data = mtcars, model = m3, x_var.name = "wt", y_var.name = "mpg", moderator.name = "hp",
xlab="Weight", ylab="MPG", moderator.lab="Horsepower")
# }
# NOT RUN {
# }
# NOT RUN {
# this shows the function is compatible with ggplot2 customization
library(extrafont)
m1 <- lm(mpg ~ vs + carb + hp + wt + wt * hp , data = mtcars)
plot_effect(reg.coef = summary(m1)$coefficients,
data = mtcars, model = m1,
x_var.name = "wt", y_var.name = "mpg", moderator.name = "hp",
confidence_interval = TRUE, CI_Ribbon = TRUE,
xlab = "Weight", ylab = "MPG", moderator.lab = "Horsepower") +
ggplot2::theme(text=ggplot2::element_text(family="Times New Roman", size = 16))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab