这里有一个很好的解释如何使用 ggplot2 创建散点图,使用 nls 拟合数据,并绘制拟合图,所有这些都在一行中,就像这样
myhist = data.frame(size = 10:27, counts = c(1L, 3L, 5L, 6L, 9L, 14L, 13L, 23L, 31L, 40L, 42L, 22L, 14L, 7L, 4L, 2L, 2L, 1L) )
ggplot(data=myhist, aes(x=size, y=counts)) + geom_point() +
geom_smooth(method="nls", formula = y ~ N * dnorm(x, m, s), se=F,
start=list(m=20, s=5, N=300))
我的问题是:使用这种结构,是否可以从该调用中提取实际的 nls 对象?我想知道我的系数等。现在我不知道如何在不进行单独的 nls 调用的情况下获得它们。