16.4.08

Applying Cochran-Mantel–Haenzel (CMH) general association test

Compiled by Rupesh R

Here the objective is to determine the general association between categorical variables subject and ranking for each emotion.

The CMH general association test is applied for this purpose. Proc freq is as described below to carry out the test. Proc freq generates p-values corresponding to each emotion and the results are outputted to the dataset hypnosis1.


The dataset is created as follows


data hypnosis;
input subject emotion $ ranking @@;
cards;
1 fear 4 1 joy 3 1 sadness 1 1 calmness 2
2 fear 4 2 joy 2 2 sadness 3 2 calmness 1
3 fear 3 3 joy 2 3 sadness 4 3 calmness 1
4 fear 4 4 joy 1 4 sadness 2 4 calmness 3
5 fear 1 5 joy 4 5 sadness 3 5 calmness 2
6 fear 4 6 joy 3 6 sadness 2 6 calmness 1
7 joy 4 7 joy 1 7 sadness 2 7 calmness 3
8 joy 3 8 joy 4 8 sadness 2 8 calmness 1
;
run;


The following code is used to carry out the analysis. The option ‘cmh’ in the ‘tables’ statement carries out the test. The option ‘cmhga’ presents the P-value for CMH General Association without a warning in the log.


proc sort;
by emotion;
run;



proc freq;
tables subject*ranking / cmh;
by emotion;
output out=hypnosis1 cmhga;
run;


The dataset hypnosis1 is obtained as follows





























emotion_CMHGA_DF_CMHGAP_CMHGA
calmness14140.449711056
fear10100.440493285
joy20.25210.505479124
sadness21210.458944209


In the dataset p_cmhga will be labeled as ’ P-value for CMH General Association’; df_cmhga as “DF for CMH General Association” and _cmhga_ as “CMH General Association” .

No comments: