chi2_risk(M)
Computes a Risk test using data in matrix M and a significance level of 0.95 (95%). Matrix M must store a contingency table 2x2.
chi2_risk(M, alpha)
As above but the significance level is alpha.
See also chi2_mcnemar chi2_kappa chi2_mantel chi2_mcnemarbowker
Example
The contingency table below shows some facts about drinking, and heart attacks:
|
|||
Entering the basic data in a matrix we obtain:
M = ( 70, 52; 29, 48)
/ 70 52 \
\ 29 48 /
We now use function chi2_totable to transform the matrix into a proper contingency table
M=chi2_totable(M)
/ "" "" "" "" \
| "" 70 52 122 |
| "" 29 58 77 |
\ "" 99 100 199 /
Using the function chi2_risk we obtain,
chi2_risk(M)
Risk test.
Significance level : 0.95 (95.0%)
Results:
Odds Ratio value: 2.228116710875332
Interval : (1.2423360294768229, 3.996104080932578 )
Risk ratio (first column): 1.5234595816845675
Interval : (1.1001650009990764, 2.10961909797062 )
Risk ratio (second column): 0.6837431693989071
Interval : (0.5223155228288222, 0.8950618950930114 )
Number of valid cases: 199