www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ComputeCoefficientCovarianceandStandardErrorsExample.m
%% Compute Coefficient Covariance and Standard Errors % This example shows how to compute the covariance matrix and standard errors % of the coefficients. % Copyright 2015 The MathWorks, Inc. %% % Load the sample data and define the predictor and response variables. load hospital y = hospital.BloodPressure(:,1); X = double(hospital(:,2:5)); %% % Fit a linear regression model. mdl = fitlm(X,y); %% % Display the coefficient covariance matrix. CM = mdl.CoefficientCovariance %% % Compute the coefficient standard errors. SE = diag(sqrt(CM))