Rollie Parrish
Dec 5, 2014
### Results
2 + 2 = `r 2 + 2`
2 + 2 = 4
Processes the R Code chunks along with R Markdown to produce final output
“Chuck options” control how the R code is processed.
{r plot1, fig.width=10, fig.align='center'}
{r plot2, fig.width=5, fig.align='right'}
Question Is the percentage of smokers significantly different between groups of patients?
Data The count of patients and the count of smokers.
conf.level <- 0.99
smokers <- c( 80, 84)#, 129, 90)
patients <- c( 86, 93)#, 136, 120)
results <- prop.test(smokers, patients)
results
2-sample test for equality of proportions with continuity
correction
data: smokers out of patients
X-squared = 0.1456, df = 1, p-value = 0.7028
alternative hypothesis: two.sided
95 percent confidence interval:
-0.06486486 0.11887836
sample estimates:
prop 1 prop 2
0.9302326 0.9032258
results are assigned to variables so we can insert the elements inline
estimates <- paste(round(results$estimate * 100,1),"%",
collapse=" vs. ", sep="")
p_value <- ifelse(results$p.value < .001,
0.001, round(results$p.value,3))
p_eq_lt <- ifelse(p_value > .001,
"=", "<")
p_sig <- ifelse(p_value > 1-conf.level,
"not", "")
p_value | p_eq_lt | p_sig | estimates |
---|---|---|---|
0.703 | = | not | 93% vs. 90.3% |
This example evaluates the smoking status from `r length(patients)` groups of patients.
Chi-square analysis indicates the proportions of smokers are `r p_sig` significantly different between groups
(`r estimates`, $p$-value `r paste(p_eq_lt, p_value)`).
This example includes the smoking status from 2 groups of patients. Chi-square analysis indicates the proportions of smokers are not significantly different between groups (93% vs. 90.3%, \( p \)-value = 0.703).