MATLAB: OLS regression : Test if two individually not significant coefficients are significant taken altogether

f-testols regression

Hi there,
I'm cumpting this OLS regression,
Y=TOTAL_R
X=[WTI_R,GAS_R,CAC40_R,Solar_R,Gold_R,BP_R,EuroDollar_R];
Title={'WTI','GAS','CAC40','Solar','Gold','BP','Euro-dollar','TOTAL'};
OLS=LinearModel.fit(X,Y,'Intercept',true,'Varnames',Title);
display(OLS)
All my coefficents are significant at 10% excepted for Gas and Solar. So I'd like to do an F-test that test H0 : ßGas = ßSolar = 0 vs H1 : taken altogether these coefficients are significant.
But I don't really know how to start. Should I create an other regression without Gas and Solar and then compare them ?
Thank you for your help.

Best Answer

Make a reduced X matrix with just Gas & Solar, then use LinearModel.fit to predict Y from those two predictors.
The resulting OLS will have something like "F-statistic vs. constant model: 0.578, p-value = 0.565", and these values are appropriate for testing your H0.