estimate main effects and interactions

23 次查看(过去 30 天)
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