Table 控制變量*分組變量*分析變量 / CMH ;
CMH用在調整某幾個分層變量時非常強勁。CMH中的分析都是“計數”,通過數個數來計算的。所以會加在FREQ中。
這的stratified factor只能是分類變量。
舉例:
data dat6; do id = 1 to 2; do r=1 to 4; do c=1 to 4; input freq @@; output; end; end; end; datalines; 1 4 11 27 143 411 2 9 37 66 317 1183 3 3 39 84 22 182 355 2 147 94 41 139 160 1 6 11 27 143 411 2 2 37 66 317 1183 3 5 39 84 22 182 355 2 47 94 41 139 160 ; proc freq data=dat6; tables id * r * c/nopct nocol norow chisq cmh;*Nonzero Correlation;*M-H; weight freq; run;
第一個圖是沒加CMH,沒有去除中心ID效應。第二個圖是加了CMH,去掉了中心ID效應,卡方值變小。
- 當加了CMH,此時只看下圖CMH中那三個統計量,不需要看上述的統計量。
- 上圖中的M-H卡方統計量,只有在行列都有序的情況下才看。
1. 行列都有順序。
都是認為在行列都有順序的情況下使用,一般情況下都是這么用。
*row and column are in order; data dat6; do r=1 to 4; do c=1 to 4; input freq @@; output; end; end; datalines; 4 11 143 411 9 37 317 1183 39 22 182 355 147 94 139 160 ; proc freq data=dat6; tables r * c/nopct nocol norow chisq cmh;*Nonzero Correlation;*M-H; weight freq; run;
行和列都有序,也就是影響變量和反應變量都有序,看它們之間的相關性。看Non-zero Correlation, 也就是第一個。也就是非零相關。比如說服葯量和紅腫等級。只是說根據數類型據選取合適的統計方法。
這個就是卡方結果中的Mantel-Haenszel 卡方的,在不指定stratified factor時。
Spearman等級相關也是順序資料,但Spearman等級相關計算時,是用等級進行的計算,而不是頻數。
2. 行有序,就是影響變量有序
The two-level variable represents the response, and the other variable represents an explanatory variable with ordered levels
這是用trend選項實現Cochran-Armitage Test,限制是,反應變量是二分類變量。
*row is in order; data dat5; do r = 1 to 3; do c = 1 to 2; input freq @@; output; end; end; datalines; 59 25 169 29 196 9 ; proc freq data=dat5; tables r * c/nopct chisq nocol trend cmh; weight freq; run;
影響變量有序,說明隨着影響變量的順序,反應變量有某種趨勢。加上trend。比如劑量和不良時間發生數,隨着劑量增大,不良反應數減小。
3. 列有序,也就是反應變量有序。
當只有一個層時,也就是沒分層因素,基本就是方差分析。
如果有多個層,相當於分層方差分析或者K-W檢驗。
*column is in order; data dat4; do r=1 to 2; do c=1 to 3; input freq @@; output; end; end; datalines; 13 10 6 21 7 4 ; proc freq data=dat4; tables r * c/nopct nocol chisq cmh;*row means score differ; weight freq; run;
列有序,選第二個row means score differ。說明在不同區間,反應有高有底。
如果指定 / score = rank。是Friedman檢驗,說明不同group間,反應是否不同。
4. 行列都無序
data dat3; do r=1 to 3; do c=1 to 4; input freq @@; output; end; end; datalines; 112 150 205 40 200 112 135 73 362 219 310 69 ; proc freq data = dat3; table r*c/chisq cmh NOROW NOCOL;*general association; weight freq; run;
行列都無序,選最后一個,general association常規關聯。