Reputation: 12577
I'm trying to fit Gaussian peaks to my density plots in R using nls
. When I use the following equation:
fit <- nls(den.PA$y~coeffs2 * exp( - ((den.PA$x-coeffs3)/coeffs4)**2 ),
start=list(coeffs2=1.12e-2, coeffs3=1075, coeffs4=2))
I get the following error:
Error in parse(text = x) : <text>:2:0: unexpected end of input
1: ~
^
Can anyone point out to me where I have gone wrong?
Upvotes: 2
Views: 3387
Reputation: 10215
Try
fit <- nls(y~coeffs2 * exp( - ((x-coeffs3)/coeffs4)**2 ),data=den.PA,
start=list(coeffs2=1.12e-2, coeffs3=1075, coeffs4=2))
Upvotes: 3