R中的指数拟合
我有一个两列的数据集,我想拟合指数曲线,并在图表上显示方程。 你能帮我查一下密码吗R中的指数拟合,r,ggplot2,curve-fitting,curve,exponential,R,Ggplot2,Curve Fitting,Curve,Exponential,我有一个两列的数据集,我想拟合指数曲线,并在图表上显示方程。 你能帮我查一下密码吗 x<-1:6 y<-c(86000,114597,165576,207467,328745,531531) df<-as.data.frame(cbind(x,y)) ggplot(df,aes(x,y))+ geom_point()+ geom_line(colour=" dark blue")+ geom_smooth(method = "nls&
x<-1:6
y<-c(86000,114597,165576,207467,328745,531531)
df<-as.data.frame(cbind(x,y))
ggplot(df,aes(x,y))+
geom_point()+
geom_line(colour=" dark blue")+
geom_smooth(method = "nls",se = F)+
scale_y_continuous(labels = scales::comma)+
theme_economist()+
xlab("Grade")+
ylab("Salary avg")
x设置:
库(ggplot2)
谢谢!!!如何在图表上显示这个等式?只要知道指数和y值来拟合曲线,其他人就必须提供帮助。(您可以在ggplot2
之外安装glm
或nls
来检索系数)我想,您可以方便地使用ggpmisc软件包来实现这一点。是否需要查看特定的函数?(ggpmisc
里面有很多东西。)它适用于glm
/nls
fits(我看到的一些框架只适用于lm
)你能帮我编写代码吗?对不起,我是R编程新手