LDPE_ester_80 <- read.table(text="Time Value SampleID
0 0.043501842 PP_0m_3a
0 0.062837605 PP_virgin_1a
0 0.047448064 PP_virgin_1b
0 0.06169221 PP_virgin_2a
30 0.164727573 PP_1_mhnes_UV_1a
30 0.143102841 PP_1m_1a
30 0.172545413 PP_1_mhnes_UV_1b
30 0.169354044 PP_1m_2a
60 0.223527391 PP_2_mhnes_UV_1a
60 0.134201756 PP_2m_1b
60 0.177466856 PP_2_mhnes_UV_1b
60 0.194665864 PP_2m_3b
60 0.281681336 PP_2m_4b
90 0.41039937 PP_3m_1a
90 0.398709677 PP_3m_1b
90 0.339117621 PP_3m_2a
90 0.379362836 PP_3m_3b
120 0.601786493 PP_4m_1a
120 0.784720551 PP_4m_2b
120 0.58218528 PP_4m_3a
120 0.586435863 PP_4m_3b
150 1.008573326 PP_5m_1a
150 1.00662725 PP_5m_1b
150 0.435590375 PP_5m_3a
150 0.57474698 PP_5m_4a", header=TRUE)
经过线性回归后,我发现指数模型最适合。但是在ggplot中表现不佳。该模型是:
exp.model <-lm(log(Value) ~ Time, data=LDPE_ester_80)
和ggplot:
ggplot(LDPE_ester_80, aes(Time, Value) ) +
geom_point() +
stat_smooth(method = lm, formula = log(y) ~ x, fill="mediumorchid4", colour="mediumorchid4", size=1.5, alpha = 0.2)+
theme_classic() +
theme(text = element_text (family = "Calimbri", size = 12))+
geom_point(shape=8, size=4, color="blue") +
ggtitle("exponetial regression")
我确信错误很容易找到,但是我还没有!
答案 0 :(得分:2)
stat_smooth
与实际的y
值一起使用,则效果最好。无法自动对结果进行运行日志转换。最好从头开始绘制log(Value)
。
ggplot(LDPE_ester_80, aes(Time, log(Value)) ) +
geom_point() +
stat_smooth(method = lm, formula = y ~ x, fill="mediumorchid4", colour="mediumorchid4", size=1.5, alpha = 0.2)+
theme_classic() +
theme(text = element_text (family = "Calimbri", size = 12))+
geom_point(shape=8, size=4, color="blue") +
ggtitle("exponetial regression")
答案 1 :(得分:0)