[R] problem with nls....
akshay kulkarni
@k@h@y_e4 @end|ng |rom hotm@||@com
Sat Mar 23 09:04:43 CET 2019
dear Ivan and members,
I was able to solve my problem. After going through Gauss Newton method, I tried to extract the Hessian,Gradient and the Jacobian from the nls call. But I could not succeed. However I observed that my formula contained only one parameter. Then the objective function is just a quadratic in that parameter. I applied directly Newton Raphson method and got the value of the parameter. To my surprise, it was the same as the output of the nls call!
I think I have to accept the value of the parameter, even though it is not a good fit. The world is very harsh(sometimes only?)!
I should thank Ivan for initiating me in the right direction...
very many thanks for your time and effort...
Yours sincerely,
AKSHAY M KULKARNI
________________________________
From: Ivan Krylov <krylov.r00t using gmail.com>
Sent: Thursday, March 21, 2019 9:06 PM
To: r-help using r-project.org
Cc: akshay kulkarni
Subject: Re: [R] problem with nls....
One of the assumptions made by least squares method is that the
residuals are independent and normally distributed with same parameters
(or, in case of weighted regression, the standard deviation of the
residual is known for every point). If this is the case, the parameters
that minimize the sum of squared residuals are the maximum likelihood
estimation of the true parameter values.
The problem is, your data doesn't seem to adhere well to your formula.
Have you tried plotting your HF1 - ((m/HF6) + 1) against HF6 (i.e. the
residuals themselves)? With large residual values (outliers?), the loss
function (i.e. sum of squared residuals) is disturbed and doesn't
reflect the values you would expect to get otherwise. Try computing
sum((HF1 - ((m/HF6) + 1))^2) for different values of m and see if
changing m makes any difference.
Try looking up "robust regression" (e.g. minimize sum of absolute
residuals instead of squared residuals; a unique solution is not
guaranteed, but it's be less disturbed by outliers).
--
Best regards,
Ivan
[[alternative HTML version deleted]]
More information about the R-help
mailing list