estimate main effects and interactions

조회 수: 30 (최근 30일)
Dan Howe
Dan Howe 2020년 2월 17일
댓글: dpb 2020년 2월 19일
Hi,
I'm trying to replicate Minitab functionality by creating a Pareto Chart of standardised effects.
I'm using data from the example linked here where a DOE was run with 4 inputs and the response was measured. In the link, a full effects table is calculated which has effects of each of the inputs A,B,C & D but also all of the interaction terms.
In Matlab I'm trying to use stepwiselm to fit a model to the table of data but I find that Matlab is removing terms based on their P-value. is there a way to use this function but ask for all linear and interaction terms to be retained?
Secondly, I'm looking at the functions plotEffects() and plotInteraction() to use on the model but is there a function or way to group all main & interaction effects together in a single table, as per table 2 in the link above?
Many thanks, Dan
  댓글 수: 6
dpb
dpb 2020년 2월 18일
You see the output from fitlm--for the specified model you get the coefficent estimates and statistics for each term in the model; the "effect" is just the magnitude of the coefficient. There's a whole bunch of other anciliary data available from the LinearModel object.
The precise format of a table in the identical form as above you'll undoubtedly have to create yourself from the information; MATLAB doesn't know how any particular user will want the output to look...
Dan Howe
Dan Howe 2020년 2월 18일
Thanks a lot for the support, I didn't appreciate that the coefficients from the model are termed the same as main effects.

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2020년 2월 18일
I was able to replicate the effect estimates, but only via a rather odd normalization scheme of the variables:
data = [1 10 220 10 50 8 70
2 15 220 10 50 2 60
3 10 240 10 50 10 89
4 15 240 10 50 4 81
5 10 220 12 50 16 60
6 15 220 12 50 5 49
7 10 240 12 50 11 88
8 15 240 12 50 14 82
9 10 220 10 80 15 69
10 15 220 10 80 9 62
11 10 240 10 80 1 88
12 15 240 10 80 13 81
13 10 220 12 80 3 60
14 15 220 12 80 12 52
15 10 240 12 80 6 86
16 15 240 12 80 7 79];
A = data(:,2);
B = data(:,3);
C = data(:,4);
D = data(:,5);
Y = data(:,7);
A = normalize(A,'zscore','robust');
B = normalize(B,'zscore','robust');
C = normalize(C,'zscore','robust');
D = normalize(D,'zscore','robust');
Y = 2*Y;
tbl = table(A,B,C,D,Y);
mdl = fitlm(tbl,'Y ~ A + B + C + D + A:B + A:C + A:D + B:C + B:D + C:D + A:B:C + A:B:D + A:C:D + B:C:D + A:B:C:D')
The normalization of the explanatory variables is a standard one, but I have no idea the reason behind needing to multiply the response variable by 2.
A slightly simpler way to specify the model in this case would be
modelMatrix = fullfact([2 2 2 2])-1;
mdl = fitlm([A B C D],Y,modelMatrix)
That's more of a Design of Experiments approach, I guess, but it boils down to the same thing.
  댓글 수: 5
the cyclist
the cyclist 2020년 2월 18일
Great! Post here if you find out why that normalization scheme makes any sense. :-)
dpb
dpb 2020년 2월 19일
I hadn't actually looked at the link before...makes no sense to me why would have done from what is published there, certainly. Maybe if one looked at the original references could deduce why.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Behavior and Psychophysics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by