我正在尝试使用 nls
将高斯峰值拟合到 R 中的密度图。当我使用以下等式时:
fit <- nls(den.PA$y~coeffs2 * exp( - ((den.PA$x-coeffs3)/coeffs4)**2 ),
start=list(coeffs2=1.12e-2, coeffs3=1075, coeffs4=2))
我收到以下错误:
Error in parse(text = x) : <text>:2:0: unexpected end of input
1: ~
^
谁能指出我哪里错了?
最佳答案
尝试
fit <- nls(y~coeffs2 * exp( - ((x-coeffs3)/coeffs4)**2 ),data=den.PA,
start=list(coeffs2=1.12e-2, coeffs3=1075, coeffs4=2))
关于R:使用 nls 解析时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10227757/