2
我有60棵樹的數據框。根據DOY,我需要爲EWMZ找到一個斜坡。我使用了混合模型,發現了一個負斜率,但是在繪製曲線時,它給了我一個積極的迴歸曲線。我不知道我用ggplot進行繪圖的方式是否正確。爲混合模型繪製迴歸曲線圖
DOY EWMZ TREE
247 13,01 1
262 11,01 1
274 23,07 1
288 23,09 1
310 20,77 1
247 28,47 2
262 22,55 2
274 15 2
288 13,93 2
310 13,73 2
240 21,56 3
247 18,48 3
262 22 3
274 22,29 3
288 19,69 3
310 19,46 3
233 24,12 4
240 23,16 4
247 20,01 4
262 17,5 4
274 20,05 4
288 19,76 4
310 20,92 4
240 9,82 5
247 15,96 5
262 12,44 5
274 9,35 5
288 11,07 5
310 8,69 5
library(lme4)
library(sjPlot)
library(sjmisc)
library(ggplot2)
Model.1 <- lmer(EWMZ ~ DOY + (1 | TREE), data = Data.Grad.EWMZ)
mas <- ggplot(Data.Grad.EWMZ, aes(x = DOY, y = EWMZ)) + labs(x="Day of
year",y="Totall number of cells")+
geom_point(shape = 16, size=1.8, col="red") +
geom_smooth(method = "lm", fill = "dodgerblue", level = .95)+
theme(panel.background = element_rect(fill = 'White', colour = 'White'))+
theme(axis.line = element_line(colour = "darkgrey",
size = 1, linetype = "solid"))+
theme_classic()
謝謝你的工作。 – Mori22