可以说我有这个代码:
dt <- data.frame(x = (1:9), z = c(6,5,3,7,8,3,1,6,7), y = c(1,0,1,1,0,0,0,1,0))
model1 <- glm(y ~ x + z, family = binomial(link = "logit"),
data = dt)
model2 <- glm(y ~ x + z, family = binomial(link = "logit"),
data = dt)
summary(model1)
summary(model2)
library(sjPlot)
m <- plot_model(model1, title = "Predicted probabilities", type = "pred", terms = "x")
n <- plot_model(model2, title = "Predicted probabilities", type = "pred", terms = "x")
我想合并两个图表,这样我就可以将它们保存在一个文件中。在这两个图中,您都可以从 sjPlot 包中找到预测概率。
我怎样才能做到这一点?
我par(mfrow=c(2,2))
已经尝试过了,但它根本不起作用。
任何帮助表示赞赏!