# Within- & between-subjects in 'anovan'

19 visualizzazioni (ultimi 30 giorni)
z8080 il 15 Nov 2019
Commentato: Eric T il 18 Ago 2022
In the anovan function, there seems to be no way of specifying whether the data is dependent across one of the factors, i.e. whether each of these factors is a within- or a between-subjects factor. It is of course essential to know whether different levels of a factor implies values obtained from the same subject ("within-subjects" factor), or from different subjects ("between subjects factor"). The lack of even the terms within- & between-subjects in the entire documentation of this function seems very strange, since this distinction is made in most stats textbooks.
Also, if a significant interaction is reported by this analysis, how does one then use the same anovan function (or a different one in Matlab) to decompose the interaction and make comparisons, for each level of one factor, between the levels of the remaining factor?
Finally, how can I obtain measures of effect size corresponding to a certain comparison, such as omnibus contrast between all levels of a factor, or a pairwise contrast between two specific levels?
Thanks for any help!
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Jeff Miller il 17 Nov 2019
I also found the lack of between/within terminology a bit daunting. With respect to your first question, here is an example that might help with the mapping between the between/within format and the anovan format:
%A: Between-subjects factor 'Age' with 2 levels
%B: Within-subjects factor 'Drug' with 2 levels
% Here are the data in the four conditions,
% with three Ss tested in each condition.
A1B1=[73 81 86];
A1B2=[59 67 60];
A2B1=[61 60 59];
A2B2=[63 50 61];
Y=[A1B1 A1B2 A2B1 A2B2];
B=[1 1 1 ...
2 2 2 ...
1 1 1 ...
2 2 2];
A=[1 1 1 ...
1 1 1 ...
2 2 2 ...
2 2 2];
S=[1 2 3 ...
1 2 3 ...
4 5 6 ...
4 5 6];
nesting=[0 0 0; ... % This line indicates that factor A is not nested in any other factor.
0 0 0; ... % This line indicates that factor B is not nested in any other factor.
1 0 0]; % This line indicates that S (the third factor) is nested under A
% (the 1 in position 1 on the line indicates nesting under the first factor).
[p table stats]=anovan(Y,{A B S},...
'model',2,...
'random',3,...
'nested',nesting,...
'varnames',{'Age', 'Drug', 'Subj'});
Don't know the answers to the rest of your questions--sorry--but I hope this helps you get started.
##### 3 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Raymond MacNeil il 14 Apr 2020
This is a fantastic example on how to perform a mixed–design ANOVA. Also, a good demo on using terms matrices to sepcify the model. Thanks!
Eric T il 18 Ago 2022
This may be the most helpful example I have seen, inside or outside the documentation, on handling anovan with a complex dataset. Thanks a lot!

Accedi per commentare.

### Più risposte (1)

the cyclist il 15 Nov 2019
This documentation page seems to be a pretty exhaustive description of how one can specify the test.
##### 2 CommentiMostra NessunoNascondi Nessuno
z8080 il 16 Nov 2019
Thanks, there is indeed a lot of information – as well as a lot of overlap – across those pages. However, my specific questions are still not addressed in there..
Raymond MacNeil il 14 Apr 2020
Agreed. Jeff's example, nevertheless, is an excellent supplement to the documentation.

Accedi per commentare.

### Categorie

Scopri di più su ANOVA in Help Center e File Exchange

R2016a

### Community Treasure Hunt

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

Start Hunting!

Translated by