Hypothesis Tests for Constrained Linear Regression
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, I would like to do the hypothesis test for the following linear regression with equality constrants to exam the significance of each parameters
min_s || y - Xs ||^2
s.t. A s = b
is there any MATLAB build in function that can do the test?
댓글 수: 4
Jeff Miller
2022년 12월 9일
Assuming that the error scores associated with the y values are mutually independent, then you should be able to do this if you can formulate the hypothesis of interest as a comparison between two linear models--specifically, a smaller one nested in a larger one. This would be done using the outputs of the glm's for the two models.
Examining "the significance of each predictor" usually involves testing a smaller model without the predictor against a larger model with the predictor, so that part sounds possible. It will probably come down to what constraints you want to enforce on the parameter values and whether you can formulate nested linear models obeying those constraints.
답변 (1개)
the cyclist
2022년 12월 10일
편집: the cyclist
2022년 12월 10일
Here is an example of doing this with an ordinary least squares regression. I compare
- standard error of the coefficient (of x1 term)
- bootstrap estimate of the same standard error
% Set random seed, for reproducibility
rng default
% Number of observations
N = 100;
% Explanatory variables
x1 = rand(N,1);
x2 = rand(N,1);
X = [x1, x2];
% Response variable, generated from explanatory plus some noise
y = 2 + 3*x1 + 5*x2 + 0.07*randn(N,1);
% Fit the model
mdl = fitlm(X,y);
% To estimate the parameter uncertainty, run the same fit with resampled data
% Number of resamples
NRESAMPLE = 5000;
% Preallocate the beta for x1, for all the resamples
beta_x1_R = zeros(NRESAMPLE,1);
% Loop over the models
for nr = 1:NRESAMPLE
% "Bootstrap" sample of the data
idx = randsample(N,N,true);
XR = X(idx,:);
yR = y(idx,:);
% Fit the model on the resampled data
mdlR = fitlm(XR,yR);
% Store the beta of x1, for the resampled fit
beta_x1_R(nr) = mdlR.Coefficients.Estimate(2);
end
% Standard error of the original fit
x1_standard_error_original_fit = mdl.Coefficients.SE(2)
% The bootstrap estimate of the standard error is the standard
% deviation of coefficients from the resampled fits.
% Notice that it is comparable to the above estimate.
x1_standard_error_resample = std(beta_x1_R)
I think you ought to be able to do the same with your constrained fit.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Hypothesis Tests에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!