【发布时间】:2021-09-29 16:12:36
【问题描述】:
我已经尝试了这里找到的许多建议,但我就是想不通。
是否可以从符合 stat_smooth 的直线中提取方程 (y = a+exp(-b*x))?
这是一个数据示例:
df <-data_frame(Time = c(0.5,1,2,4,8,16,24), Concentration = c(1,0.5,0.2,0.05,0.02,0.01,0.001))
Plot <- ggplot(df, aes(x=Time, y=Concentration))+
geom_point(size=2) +
stat_smooth(method = nls, formula = y ~ a*exp(-b *x),
se = FALSE,
method.args = list(start = c(a=10, b=0.01)))+
theme_classic(base_size = 15) +
labs(x=expression(Time (h)),
y=expression(C[t]/C[0]))
我尝试使用 "stat_regline_equation" ,但是当我添加指数函数时它不起作用。
【问题讨论】:
-
提取是什么意思?你想达到什么目标?
-
我想把指数函数的a和b参数拿到线。
标签: r ggplot2 exponential model-fitting