PH 241: Statistical Analysis of Categorical Data
Chapter 1 Packages
- we always include a setup chunk to include packages we use in the rmarkdown file, these are packages we usually use in this course:
dplyr is a grammar of data manipulation, providing a consistent set of verbs that help you solve the most common data manipulation challenges.
library(dplyr) mutate() # adds new variables that are functions of existing variables select() # picks variables based on their names. filter() # picks cases based on their values. summarise() # reduces multiple values down to a single summary. arrange() # changes the ordering of the rows.
Tools for the analysis of epidemiological and surveillance data.
Contains functions for directly and indirectly adjusting measures of disease frequency, quantifying measures of association on the basis of single or multiple strata of count data presented in a contingency table, computation of confidence intervals around incidence risk and incidence rate estimates and sample size calculations for cross-sectional, case-control and cohort studies.
library(epiR) epi.2by2() # Computes summary measures of risk and a chi-squared test for difference in a 2 by 2 table
Tools for training and practicing epidemiologists including methods for two-way and multi-way contingency tables.
library(epitools) epitable() # Create r x c contigency table for r exposure levels and c outcome levels epitab() # Calculates risks, RR, OR, and CIs for epidemiologic data
Reading and writing data stored by some versions of ‘Epi Info,’ ‘Minitab,’ ‘S,’ ‘SAS,’ ‘SPSS,’ ‘Stata,’ ‘Systat,’ ‘Weka,’ and for reading and writing some ‘dBase’ files.
library(foreign) read.dta() # Reads a file in Stata version 5–12 binary format into a data frame
Mark Stevenson, Evan Sergeant with contributions from Telmo Nunes, Cord Heuer, Jonathon Marshall, Javier Sanchez, Ron Thornton, Jeno Reiczigel, Jim Robison-Cox, Paola Sebastiani, Peter Solymos, Kazuki Yoshida, Geoff Jones, Sarah Pirikahu, Simon Firestone, Ryan Kyle, Johann Popp, Mathew Jay and Charles Reynard. (2020). epiR: Tools for the Analysis of Epidemiological Data. R package version 2.0.17. https://CRAN.R-project.org/package=epiR↩︎