2 way anova for pre post design

Hi
I'm trying to work out a 2 way anova / anova2 or anovan, syntax.
I have 2 groups that have pre and post scores.
I have 4 columns : Pre scores of group A, Post scores Group A, Pre of Group B, Post Group B.
The groups are not the same size
I want to perform a 2 way anova of both time and group effects (between groups).
After reading both anovan and anova2, I'm still having issues how to perform this....
tnx

 採用された回答

Jeff Miller
Jeff Miller 2019 年 8 月 27 日
編集済み: Jeff Miller 2019 年 8 月 28 日

1 投票

First reformat your data to have one row per individual. The data table 'tbl' should look something like this:
Group t1 t2
1 88 99 % I have no idea what your actual number values are.
1 53 71
...
2 112 101.1
2 123 63.1
2 134 71.3
...
You will have different numbers of rows for the two groups since your sample sizes are not equal.
Then, use MATLAB's ranova function. The first example under 'Longitudinal Data' is pretty close to what you want, except you have only 2 time points instead of 8. So, your command will be something like this:
Time = categorical([1 2]);
tbl.Group = categorical(tbl.Group);
rm = fitrm(t,'t1-t2 ~ Group','WithinDesign',Time);
I may not have the categorical commands just right, but it is important (I think) so that ranova treats these as categorical independent variables rather than regression-type predictors.

2 件のコメント

AmirH
AmirH 2019 年 8 月 31 日
Thank you!!!
Jeff Miller
Jeff Miller 2019 年 9 月 1 日
If it works, please accept the answer.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2019 年 8 月 27 日

コメント済み:

2019 年 9 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by