# leading question re gun permit example # success = favor # neutral versus leading favor <- c(463,403) size <- c(615,585) prop.test(favor,size,correct=0) prop.test(favor,size,correct=1) # HIV vaccine trial # success = HIV positive # control versus vaccine hivpositive <- c(126,241) size <- c(1691,3598) prop.test(hivpositive,size,correct=0) prop.test(hivpositive,size,correct=1) # West of Scotland coronary prevention study # Initial 5 year study period # success = has coronary event # pravastatin versus placebo coronaryevent <- c(174,248) size <- c(3302,3293) prop.test(coronaryevent,size,correct=0) prop.test(coronaryevent,size,correct=1) # West of Scotland coronary prevention study # 5 years plus 10 year followup study # success = has coronary event # pravastatin versus placebo coronaryevent <- c(390,509) size <- c(3302,3293) prop.test(coronaryevent,size,correct=0) prop.test(coronaryevent,size,correct=1) --------------- results ----------------------- > > # leading question re gun permit example > # success = favor > # neutral versus leading > favor <- c(463,403) > size <- c(615,585) > prop.test(favor,size,correct=0) 2-sample test for equality of proportions without continuity correction data: favor out of size X-squared = 6.1055, df = 1, p-value = 0.01348 alternative hypothesis: two.sided 95 percent confidence interval: 0.01326543 0.11464785 sample estimates: prop 1 prop 2 0.7528455 0.6888889 > prop.test(favor,size,correct=1) 2-sample test for equality of proportions with continuity correction data: favor out of size X-squared = 5.7912, df = 1, p-value = 0.01611 alternative hypothesis: two.sided 95 percent confidence interval: 0.01159773 0.11631555 sample estimates: prop 1 prop 2 0.7528455 0.6888889 > # HIV vaccine trial > # success = HIV positive > # control versus vaccine > hivpositive <- c(126,241) > size <- c(1691,3598) > prop.test(hivpositive,size,correct=0) 2-sample test for equality of proportions without continuity correction data: hivpositive out of size X-squared = 1.0102, df = 1, p-value = 0.3149 alternative hypothesis: two.sided 95 percent confidence interval: -0.00741547 0.02247640 sample estimates: prop 1 prop 2 0.07451212 0.06698166 > prop.test(hivpositive,size,correct=1) 2-sample test for equality of proportions with continuity correction data: hivpositive out of size X-squared = 0.897, df = 1, p-value = 0.3436 alternative hypothesis: two.sided 95 percent confidence interval: -0.007850119 0.022911052 sample estimates: prop 1 prop 2 0.07451212 0.06698166 > # West of Scotland coronary prevention study > # Initial 5 year study period > # success = has coronary event > # pravastatin versus placebo > coronaryevent <- c(174,248) > size <- c(3302,3293) > prop.test(coronaryevent,size,correct=0) 2-sample test for equality of proportions without continuity correction data: coronaryevent out of size X-squared = 14.08, df = 1, p-value = 0.0001752 alternative hypothesis: two.sided 95 percent confidence interval: -0.03441898 -0.01081288 sample estimates: prop 1 prop 2 0.05269534 0.07531127 > prop.test(coronaryevent,size,correct=1) 2-sample test for equality of proportions with continuity correction data: coronaryevent out of size X-squared = 13.705, df = 1, p-value = 0.0002139 alternative hypothesis: two.sided 95 percent confidence interval: -0.03472224 -0.01050962 sample estimates: prop 1 prop 2 0.05269534 0.07531127 > # West of Scotland coronary prevention study > # 5 years plus 10 year followup study > # success = has coronary event > # pravastatin versus placebo > coronaryevent <- c(390,509) > size <- c(3302,3293) > prop.test(coronaryevent,size,correct=0) 2-sample test for equality of proportions without continuity correction data: coronaryevent out of size X-squared = 18.6161, df = 1, p-value = 1.599e-05 alternative hypothesis: two.sided 95 percent confidence interval: -0.05300154 -0.01991859 sample estimates: prop 1 prop 2 0.1181102 0.1545703 > prop.test(coronaryevent,size,correct=1) 2-sample test for equality of proportions with continuity correction data: coronaryevent out of size X-squared = 18.3077, df = 1, p-value = 1.879e-05 alternative hypothesis: two.sided 95 percent confidence interval: -0.05330480 -0.01961533 sample estimates: prop 1 prop 2 0.1181102 0.1545703 >