I am running a 3-parameter nonlinear fit using the default Gauss-Newton
method of nls.


initialValues.L = list(b=4,d=0.04,t=180);

fit.nls.L = nls(
myModel.nlm ,
fData.L,
start = initialValues.L,
control = nls.control(warnOnly = TRUE),
trace=T
);
summary.nls.L = summary(fit.nls.L);


I run the same analysis in SAS proc NLIN.


proc nlin data=apples outest=a;
parms b=4 d=.04 t=180;
model Y = b/(1+exp(-d*(X-t)));
output out=b p=yhat r=yresid ;
run;

proc print data=a;
run;

A summary of the outputs:

   - Same coefficients (this is a good thing)
   - Same standard errors of the coefficients (also good)
   - Different covariance matrices (WHY?)

I convert the cov.unscaled from R's NLS to a correlation and compare it to
SAS's correlation.  They are identical;
e.g., cov2cor(summary.nls.L$cov.unscaled)

I have even written a function to convert an NLS object into a "cov.scaled"
element that is equivalent to SAS:

scaledCOV = function (nlsObject)
{
 myFactor = nlsObject$cov.unscaled[1,1]/(nlsObject$coefficients[1,2]^2);
 myScaled = nlsObject$cov.unscaled/myFactor;
 myScaled;
}

so with this function I can determine the factor difference between R and
SAS (which is different with each data run of NLS and NLIN).  This factor is
based on the same standard errors:

summary.nls.L$cov.scaled = scaledCOV(summary.nls.L$cov.unscaled);

In SAS, the covariance is based on MSE * (r'r) / (n-p) using the
Gauss-Newton method.

My question is, how is the cov.unscaled built in R's nls?  Specifically, why
is it different from the SAS output?  Links, theoretical explanations, etc.
are all appreciated.

I can explain how I inferred a difference to a referee of a journal
submission, but it would be helpful to also be able to understand why so I
can make a more valid argument.


Thanks in advance!


monte

{x:

	[[alternative HTML version deleted]]

