Version 0.01 (2.53 KB) by Meade
Calculate the VARIANCE-COVARIANCE matrix from the outputs of the |fit| function.
Updated 5 Aug 2019

View License

VARCOV calculates the variance-covariance matrix for a regression created with the Matlab |fit| function.
This matrix is not otherwise directly accessible through the |fit| function, though it is used in the lease-squares optimization and referenced in the documentation as well as in alternative fitting algorithms (like |nlinfit|).

This algorithm does NOT use the primary input-output scatter matrix to calculate and thus the output of VARCOV will be dependent on the goodness of fit of your regression. There are numerous alternatives to calculate this directly, i.e. |cov|.

For reasons that are unclear to me, the VARCOV is not available directly from the least-squares fitting algorithm used in |fit|. However, the relationship between the Jacobian and error Residuals is referenced in the documentation. Credit to Mark L. Stone on StackExchange for an excellent answer that provided the framework to figure this out.
<, Relation between Covariance matrix and Jacobian in Nonlinear Least Squares, URL (version: 2016-08-27):>

Feedback welcome.

Cite As

Meade (2024). varcov (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Line Plots in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes