Standard deviation of each coefficient of regression model

11 次查看(过去 30 天)
I have develop a quadratic regression model based on my data set,
such as,
y = B0 + B1X1 + B2X2 + B2X1^2 + B3X2^2
To develop this model, I use the 'fitlm' funciton. Now I have a model coefficients for each variables(B0, B1, B2, B3). I
Now I want to estimate the standard deviation of each coefficients.
Could you please share an idea how I can estimate the standard deviation of each coefficients based on the response from 'fitlm' function.
Your response will be highly appriciated.

回答(1 个)

Jack
Jack 2023-3-26
Hi,
You can estimate the standard deviation of the regression coefficients using the coefCI function in MATLAB, which is available for models created using the fitlm function.
The coefCI function returns the confidence intervals for the estimated coefficients, which can be used to estimate the standard error of the coefficients by dividing the range of the confidence interval by 3.92 (for a 95% confidence interval) or 1.96 (for a 90% confidence interval).
Here's an example of how to use the coefCI function to estimate the standard deviation of the coefficients:
% generate some sample data
x1 = randn(100,1);
x2 = randn(100,1);
y = 2 + 3*x1 + 4*x2 + 1.5*x1.^2 + 2*x2.^2 + randn(100,1);
% fit the quadratic regression model
mdl = fitlm([x1 x2], y, 'quadratic');
% get the coefficients and their standard errors
coefs = mdl.Coefficients.Estimate;
[~, ~, ~, SE] = coefCI(mdl);
% calculate the standard deviation of the coefficients
SD = SE./3.92; % for a 95% confidence interval
In this example, the coefs variable contains the estimates for the coefficients, and the SE variable contains their standard errors. The SD variable contains the estimated standard deviation of each coefficient.
  1 个评论
padam bahadur karki
Could you please provide the reference for "SD = SE./3.92"?
I found the equation for SE = (CI upper limit - CI lower limit)./2*1.96.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Regression 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by