FAQ/aggregate - CBU statistics Wiki

You are not allowed to do login on this page. Login and try again.

Clear message
location: FAQ / aggregate

Using AGGREGATE to average over nuisance factors prior to using CASESTOVARS

The AGGREGATE command is useful for averaging over replications which are not of primary interest in the data.

The SPSS syntax below gives an example of reaction times which have been collected over two trials for combinations of condition and expression factors. AGGREGATE is used to average over the two trials preparatory to using CASESTOVARS to convert the data into a multivariate structure based only on the condition and expression factors appropriate for repeated measures anova.

DATA LIST LIST/id cond express rt.
BEGIN DATA  
1.00000 1.00000 1.00000 161.79563
1.00000 1.00000 2.00000 179.25575
1.00000 1.00000 3.00000 174.48904
1.00000 2.00000 1.00000 172.79117
1.00000 2.00000 2.00000 142.88101
1.00000 2.00000 3.00000 144.65885
1.00000 1.00000 1.00000 173.65432
1.00000 1.00000 2.00000 212.67775
1.00000 1.00000 3.00000 176.26829
1.00000 2.00000 1.00000 173.66079
1.00000 2.00000 2.00000 173.19224
1.00000 2.00000 3.00000 156.79325
2.00000 1.00000 1.00000 208.54508
2.00000 1.00000 2.00000 162.55911
2.00000 1.00000 3.00000 171.05088
2.00000 2.00000 1.00000 144.29592
2.00000 2.00000 2.00000 149.51765
2.00000 2.00000 3.00000 200.26122
2.00000 1.00000 1.00000 194.70055
2.00000 1.00000 2.00000 191.67842
2.00000 1.00000 3.00000 180.28423
2.00000 2.00000 1.00000 162.39449
2.00000 2.00000 2.00000 210.33432
2.00000 2.00000 3.00000 174.67304
END DATA.

SORT CASES BY COND EXPRESS.

AGGREGATE
  /OUTFILE='C:\AGG.SAV'
  /BREAK=ID COND EXPRESS
  /rt_mean = MEAN(rt).

GET FILE = 'C:\AGG.SAV'.

SORT CASES BY id cond express .             
CASESTOVARS                          
 /ID = id                           
 /INDEX = cond express. 

The resulting file contains two rows (one for each id) and six other columns of mean reaction times representing each of the six combinations of the condition and expression factors. These columns can be renamed in the spreadsheet directly or using the RENAME command. The latter may be more useful if the renaming is required for more than one data set.