2

我正在尝试使用 将高斯峰拟合到 R 中的密度图nls。当我使用以下等式时:

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: ~ 
  ^

谁能指出我哪里出错了?

4

1 回答 1

3

尝试

fit <- nls(y~coeffs2 * exp( - ((x-coeffs3)/coeffs4)**2 ),data=den.PA,
       start=list(coeffs2=1.12e-2, coeffs3=1075, coeffs4=2))
于 2012-04-19T12:40:04.793 回答