check whether regression slopes are different between 3 groups
Mostrar comentarios más antiguos
Hi there,
I have read some very helpful questions / answers that deal with the comparison of regression slopes obtained from several groups. I though still have some uncertainties and would like to ask for some guidance.
OK below is the relevant code. I'd like to compare regression slopes obtained from robustfit (3 groups).
constxxx: simply refers to the number of subjects and their data entries for the respective group.
newData1.data(1:32,1): is the predictor.
Particularly, I had to add a zero to linhyptest ([0 0 1 0; 0 0 0 1]) to make it work, I assume it's because a constant has been added by robustfit. I also believe the (X = [x, (g==2).*x, (g==3).*x]) does not need to be shifted as the the constant is added later. Finally, my understanding is that the result, if significant, would indicate an interaction.
Could anyone comment on my procedure please. Thanks very much in advance.
Best,
Torsten
g = [ones(const300,1); 2*ones(const400,1); 3*ones(const500,1)];
X = [x, (g==2).*x, (g==3).*x];
[b,s2] = robustfit(X,newData1.data(1:32,1));
[p,F] = linhyptest(b, s2.covb, [0;0], [0 0 1 0; 0 0 0 1], s2.dfe);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Multiple Linear Regression en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!