F-Test for difference between coefficients

6 views (last 30 days)
Hi there,
I need to conduct F-Tests for differences in estimated regression coefficients. That is, to say: "Yes, the one coefficient is really lower/higher than the other" or "No, they are not statistically significantly different".
I believe, the equivalent stata command would be -test-. However, I can't seem to find how to do it matlab.
Any help is greatly appreciated!
Christian

Accepted Answer

Alfonso Nieto-Castanon
Alfonso Nieto-Castanon on 22 May 2015
Edited: Alfonso Nieto-Castanon on 22 May 2015
and use a contrast H that compares the two desired coefficients (e.g. [0 1 -1] compares the second and third regression coefficients in your linear model).
Generally, for a linear model of the form:
Y = X*B + noise
coeffTest will test any hypothesis of the form:
H*B = 0
(where H can be a vector or a matrix)
  4 Comments
Christian
Christian on 31 May 2015
Thanks so much Alfonso! You were a big help indeed!
Alexis
Alexis on 5 Nov 2019
Edited: Alexis on 5 Nov 2019
This answer is very straightforward and helpful, but can anyone clarify these instructions from the ML documentation:
"If you specify the 'DummyVarCoding' name-value pair argument as 'effects' when fitting the model using fitglme, then βA + βB + βC = 0, where βA, βB, and βC correspond to suppliers A, B, and C, respectively.
βA is the effect of A minus the average effect of A, B, and C.
[...] column 5 of the contrast matrix corresponds to βC, and column 6 corresponds to βB. Therefore, the contrast matrix for this test is specified as H = [0,0,0,0,1,2]."
I specify 'DummyVarCoding','effects' when I use fitglme(). Does this mean Alfonso Nieto-Castanon's suggestion below wouldn't work for my model?
"you may wish to test whether the values in the fourth group are different from the values in any of the other three groups, so you can use a contrast [-1 0 0 1; 0 -1 0 1; 0 0 -1 1]"
In my model, I have three types of trial. In the model read out, I get
Name Estimate SE tStat DF pValue Lower
'(Intercept)' 0.03416 0.0034769 9.825 2668 2.0978e-22 0.027343
'type_1' -0.0056054 0.0010517 -5.3297 2668 1.066e-07 -0.0076677
'type_2' 0.0037668 0.0012124 3.1068 2668 0.0019112 0.0013894
... ( + the other model terms)
Given ML's documentation and my use of 'DummyVarCoding', how can I test 'type_3' against the average of 'type_1' and 'type_2'?

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!