estimate main effects and interactions
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
dpb
le 18 Fév 2020
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...
Réponse acceptée
the cyclist
le 18 Fév 2020
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)
5 commentaires
the cyclist
le 18 Fév 2020
Great! Post here if you find out why that normalization scheme makes any sense. :-)
dpb
le 19 Fév 2020
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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Behavior and Psychophysics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!