作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
test <- data.frame(Exp = c(4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6), t = c(0, 0.33, 0.67,
1, 1.33, 1.67, 2, 4, 6, 8, 10, 0, 33, 0.67, 1, 1.33, 1.67, 2, 4, 6, 8, 10,
0, 0.33, 0.67, 1, 1.33, 1.67, 2, 4, 6, 8, 10), fold = c(1,
0.957066345654286, 1.24139015724819, 1.62889151698633, 1.72008539595879,
1.82725412314402, 1.93164365299958, 1.9722929538061, 2.15842019312484,
1.9200507796933, 1.95804730344453, 1, 0.836176542548747, 1.07077717914707,
1.45471712491441, 1.61069357875771, 1.75576377806756, 1.89280913889538,
2.00219054189937, 1.87795513639311, 1.85242493827193, 1.7409346372629, 1,
0.840498729335292, 0.904130905000499, 1.23116185602517, 1.41897551928886,
1.60167656534099, 1.72389226836308, 1.80635095956481, 1.76640786872057,
1.74327897001172, 1.63581509884482))
d <- ggplot(test,aes(x=t, y=fold))+
#to make it obvious I use argument names instead of positional matching
geom_point()+
geom_smooth(method="nls",
formula=y~1+Vmax*(1-exp(-x/tau)), # this is an nls argument
method.args = list(start=c(tau=0.2,Vmax=2)), # this too
se=FALSE)
method="nls"
更改为
method = "nlsLM"
,因为在设置起始值时,原始的“nls”对我来说确实是一个大问题。
最佳答案
你似乎什么都没试过。你可以简单地做显而易见的事情:
library(ggplot2)
library(minpack.lm)
d <- ggplot(test,aes(x=t, y=fold))+
geom_point()+
geom_smooth(method="nlsLM",
formula=y~1+Vmax*(1-exp(-x/tau)),
method.args = list(start=c(tau=0.2,Vmax=2)),
se=FALSE)
print(d)
#works
nls
有助于抛出错误。
关于r - 如何在 geom_smooth 中使用方法 ="nlsLM"(在 minpack.lm 包中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45971661/
我是一名优秀的程序员,十分优秀!