[R] problem with nls....

akshay kulkarni @k@h@y_e4 @end|ng |rom hotm@||@com
Fri Mar 22 13:29:14 CET 2019


dear Ivan,
                    I think my nls call is not converging to the proper value. I've gone through the Gauss Newton algorithm implemented by nls. How do I get the gradient, Hessian, and the jacobian of the objective function created by call to the nls? Perhaps I can compare all of them between my succesful nls call and the one that didn't. I've gone through debug(nls) but of no avail.

Also, I've checked the residuals...they are approximately normally distributed....I am still wondering why the nls call is not getting converged....!

Also, is it possible that if I give the vectors HF1,Hf5,HF6 it will help members in the mailing list to get to the bottom of the problem( I am sorry to have given the printed values of the vectors in my previous response to your mail...The dput values were very large. However, I will give the dput values this time around )?

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