repeated measures ANOVA with MATLAB
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a group of n=30 individuals with no repetition. Each individual has three independent measurements (x,y,z) which are measured for each individual at the same time. I wanted to know if x,y, and z are statistically different, then if x and y, y and z, and x and z are statistically different (so, this is a within group comparison).
I thought I could use repated measures ANOVA to do this and tried the code below:
load mydata; %%mydata contains a column of IDs and three other columns associated with x, y, and z.
t = table(mydata.IDs,mydata.x,mydata.y,mydata.z,'VariableNames',{'IDs','d1','d2','d3'});
Meas = dataset([1 2 3]','VarNames',{'Measurements'})
rm = fitrm(t,'d1-d3 ~ IDs-1','WithinDesign',Meas)
ranovatbl = ranova(rm)
Here is what I receive:
ranovatbl =
SumSq DF MeanSq F pValue pValueGG pValueHF pValueLB
______ __ ______ ________ ______ ________ ________ ________
IDs:Measurements 8.6735 48 0.1807 0.037392 1 0.99997 0.99997 0.99997
Error(Measurements) 9.665 2 4.8325
Can someone please first tell me if I did this right and second how to interpret those p-values?
Thank you!
2 comentarios
Rana S.Chegani
el 4 de Dic. de 2018
I have the same question! did you manage to find the answer to it?
Charlotte Ashton
el 17 de Dic. de 2019
Hi,
I'm just wondering if you or anyone could tell me why you have specified 'IDs-1'in variable rm, instead of just 'IDs' please?
Respuestas (1)
Adam Danz
el 4 de Dic. de 2018
Editada: Adam Danz
el 4 de Dic. de 2018
There are 3 parts to the question.
Is repeated measures ANOVA appropriate for these questions?
Yes. The null hypothesis for a repeated measures ANOVA is that the 3+ variables measured on the same subjects have the same means in the population. Is the repeated measures ANOVA appropriate given then data? That I can't say. Repeated measures ANOVA follows these assumptions:
- independent, identically distributed observations
- The test variables approximately follow a normal distribution
- Assumption of sphericity (link).
Did I use ranova() correctly?
This example (<-link) demonstrates how to prepare tabular data for ranova() and you have followed those steps.
How to interpret the p values.
Your table is provided below, formatted.
pValue: the p-value for the corresponding F-statistic ("F"). The p-value is the probability of obtaining an effect at least as strong as the one in your sample data if the null hypothesis is true. Remember that the null hypothesis is that there is no differences in the means of the actual population. So, the lower the p values, the less probably that your data support the null hypothesis. Usually if p < 0.05 (or 0.01 or 0.001 in some brances of science) we reject the null hypothesis.
Going back to those assumptions I mentioned earlier, the regular p-value is accurate only if all response variables have the same variance and each pair of response variables shares a common correlation. This is dicussed in detail here (<-link). You can use the mauchy method to test of this. When this "compound symmetry" is not satisfied, you can use one of the adjusted p-values.
pValueGG pValueHF pValueLB : Respectively, these are the Greenhouse-Geisser adjustment, Huynh-Feldt adjustment, and the Lower bound adjustment.
ranovatbl =
SumSq DF MeanSq F pValue pValueGG pValueHF pValueLB
______ __ ______ ________ ______ ________ ________ ________
IDs:Measurements 8.6735 48 0.1807 0.037392 1 0.99997 0.99997 0.99997
Error(Measurements) 9.665 2 4.8325
In the example above, p is way above 0.05 so we would not reject the null hypothesis.
Sanity check: plot your data
Always plot out your data, look at it, and confirm that your statistical test results make sense. If the tests suggest that the means aren't different and your data clearly show two very different distributions, you know you did something wrong. This sanity-check can be used to catch mistakes. However, this sanity check does not necessarily confirm that you performed the statistics correctly or that your data are appropriate for the statistics you chose.
2 comentarios
matteo bottoni
el 29 de Jun. de 2020
Hi Sir, what have I to use if the distribution is not normal (so I need a no parametric test) and if I have the same situation but with X=a/b Y=b/c Z=a/c?
Ver también
Categorías
Más información sobre Analysis of Variance and Covariance en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!