Anova analysis with blocking

16 visualizaciones (últimos 30 días)
Nicolas
Nicolas el 14 de Oct. de 2022
Comentada: Nicolas el 17 de Oct. de 2022
Hi, I'm trying to do an one way Anova analysis with blocking and I can't seem to find the function for it. Does it exist?
By blocking I mean to eliminate the effect of the variability of a nuisance factor in my analysis. For example a variability in between batches of raw material or meteorological variability between daily tests. I'm using the theory behind the randomized complete block design (RCBD) to control the variability between each "block" (batches). The normal anova test can't be performed because the RCBD is a restriction on randomization. For now I only test on one factor but I'll have to test it with more than one later.
Thanks!

Respuesta aceptada

Jeff Miller
Jeff Miller el 15 de Oct. de 2022
You can do this with fitlm as long as you want to test for the effect(s) of interest within a standard linear RCBD model. The hard part will probably be figuring out how to set up dummy variables to represent the levels of the experimental and nuisance factors. It should be no problem to add more factors once you figure out how to do it for the first one.
  1 comentario
Nicolas
Nicolas el 17 de Oct. de 2022
Thanks for your quick answer! I looked into your idea and I got a little mixed up when trying to set the dummy variable. I then realized that with the anovan() function you can specify the interaction between the factors. So I simply ran the anovan() with the differents block as levels of the factor "Block". I specified a linear model with no interaction and I tested for the effect on the treatment mean. I then made sure no to draw any conclusion regarding the block when looking at the Anova table.
Here is an example on the effect of three different lubricating oils on fuel economy in diesel truck engines. Here y is the response variable (fuel economy).
% 4.13
y = [0.5 0.535 0.513 0.634 0.675 0.595 0.487 0.52 0.488 0.329 0.435 0.4 0.512 0.54 0.51];
Treat = [1 2 3 1 2 3 1 2 3 1 2 3 1 2 3];
Block = [1 1 1 2 2 2 3 3 3 4 4 4 5 5 5];
[p,table,stats,terms]=anovan(y,{Block,Treat},'sstype',2','alpha',0.05, ...
'model','linear','varnames', {'Block (Truck)','Treat (Oil)'});
terms
terms = 2×2
1 0 0 1
figure('windowstyle','docked')
normplot(stats.resid);
figure('windowstyle','docked')
subplot(1,3,1)
gscatter(Treat,stats.resid)
subplot(1,3,2)
gscatter(Block,stats.resid)
subplot(1,3,3)
gscatter(y,stats.resid)
figure('windowstyle','docked')
c = multcompare(stats,'ctype','lsd','dimension',2);

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by