*----------------------------------------------------------------------------; * SAS code to estimate the proportions of positive agreement and negative ; * agreement and their asymptotic standard errors and confidence intervals. ; * ; * Author: John S. Uebersax (14 March 2008) ; * ; * User supplies frequencies of four-fold table: ; * ; * Rater 2 ; * + - ; * +-------+-------+ ; * + | a | b | ; * Rater 1 +-------+-------+ ; * - | c | d | ; * +-------+-------+ ; * ; * and p-value for confidence interval coverage (e.g. p = .95 for 95% ; * confidence interval. ; *----------------------------------------------------------------------------; data one; * supply values here, then run program ; a = 10; b = 20; c = 30; d = 40; p = .95; * computations; z_crit = probit(1.0 - ((1.0 - p) / 2.)); Statistic = 'PA'; Estimate = (2*a) / (2*a + b + c) ; SE = (4*a *(c + b)*(a + c + b))**.5 / (2*a + b + c)**2 ; ll = estimate - z_crit * se; ul = estimate + z_crit * se; CI = '(' || put(ll, 6.4) || ' - ' || put(ul, 6.4) || ')'; output; Statistic = 'NA'; Estimate = (2*d) / (2*d + b + c) ; se = (4*d *(c + b)*(d + c + b))**.5 / (2*d + b + c)**2 ; ll = estimate - z_crit * se; ul = estimate + z_crit * se; CI = '(' || put(ll, 6.4) || ' - ' || put(ul, 6.4) || ')'; output; keep statistic estimate se ci result; run; proc print data = one noobs; run;