Search code examples
rsummarynls

how R estimates/computes the std.error in summary() of a nls.lm model?


I'm using nls.lm() function to get a MODEL. Later, I write "summary(MODEL)" and I get the list of parameters, std.error... and others convergence and model details.

The question is,

someone knows how R computes these std.error (for each parameter) shown with summary()???

Thanks!


Solution

  • If you type the function name, summary.nls.lm preceded by the package name, minpack.lm and joined by the ::: function, you see the code.

    minpack.lm:::summary.nls.lm
    

    This is the section that calculates the standard errors

    ibb <- chol(object$hessian)
    ih <- chol2inv(ibb)
    p <- length(param)
    rdf <- length(object$fvec) - p
    resvar <- deviance(object)/rdf
    se <- sqrt(diag(ih) * resvar)