问题
I have a problem with a fit curve on this data:
On x axes we have a data about wind intensity (m/s), on y axes we have log data (fish catch). I fitted a curve (nls model, Gaussian curve) only on data without logaritm, but when i tried on log data, R tell me:
Error in nls(mean.w ~ k * exp(-1/2 * (x.wind - mu)^2/sigma^2), :
singolar gradient
The model is: mean.w ~ k * exp(-1/2 * (x.wind - mu)^2/sigma^2)
, where k,mu and sigma
are the parameters to estimate, and
mean.w # is y axes (log fish catch)
x.wind # is x axes wind intensity
the fit curve on not log data is:
# Mean point in redMy aspected result on log data is a similar fit curve, with different values of parameters, the problem is, wath kind of model i must to use?
The data are:
1.1 1.4 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5
-3.0951726 NaN -2.5337439 -3.6184583 -3.2161971 -2.4405031 -1.4349350 -1.5676554 -1.0594076 -0.3290359 -1.2241878 -0.6336298
2.6 2.7 2.8 2.9 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7
-1.3863366 -1.4221593 -1.4961145 -1.2632693 -2.5509134 -4.7270333 -2.4795247 -2.0024069 -4.5975918 -2.9954250 -3.2390678 -2.6339971
3.8 3.9 4 4.1 4.2 4.3 4.4 4.5 4.6 5
-3.3419309 -3.5258236 -4.4962217 0.7027033 -3.6392906 -4.0426306 -1.0798462 NaN -3.0574602 -3.0498198
With x values from 1.1 to 5, and below log data.
回答1:
The problem is the model itself. The RHS of the model can be written:
k * exp(-1/2 * x.wind / sigma^2) * exp(1/2 * mu /sigma^2)
so k
and the rightmost factor play the same role. The parameters are not uniquely determined.
To fix this omit k
or the last factor from the model.
来源:https://stackoverflow.com/questions/40969813/how-can-fit-curve-on-this-log-data