我很难将以下模型拟合到后续数据:
y = a * exp( - b * exp( - x/c))
DF$x=c(200,300,400,500,600,700,800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000,3100,3200,3300,3400,3500,3600,3700,3800,3900,4000,4100,4200,4300,4400,4500,4600,4700,4800,4900,5000,5100,5200,5300,5400,5500,5600,5700,5800,5900,6000,6100,6200,6300,6400,6500,6600,6700,6800,6900,7000)
DF$y=c(50,150,350,550,1050,1650,2950,4750,7850,12350,18950,27250,36750,49750,63250,79050,95450,112850,134550,158050,184650,211150,237750,270150,299650,334850,373450,413050,453050,490350,534250,574050,622750,666550,707350,760250,803050,848650,893850,928250,973850,1006250,1047650,1075850,1113850,1146350,1180150,1212650,1243950,1275850,1306250,1332150,1372350,1402550,1440650,1471550,1503550,1549850,1583150,1628850,1664250,1711250,1746850,1793250,1837950,1884750,1930850,1976750,2008650)
其实,我需要一个log(y, base = 10)
情节。因此,当我使用ggplot
and时stat_smooth(method='nls',...)
,我最终会非常适合。而且我不知道如何提高合身性。你能想出一个合理的方法吗?谢谢 !
到目前为止我的代码:
ggplot(DF, aes(x = x, y = y)) + geom_point() +
stat_smooth(method = 'nls',
formula = y ~ a * exp(- b * exp( - x / 50 )),
aes(colour = 'Exponential'),
se = FALSE, start = list(a=1000,b=10)) +
scale_y_continuous(trans='log10')