Lecture 9 - Categorical Data

Basics


Intro

Categorical data includes variables with discreet (separate) categories.

Nominal data has no order, such as hair color or blood type.

Ordinal data is ordered, such as survey responses - “bad, neutral, good”.


What makes categorical data useful?

Identifies patterns and associations in health outcomes

Allows comparisons of groups

This helps decision making


Methods

Chi square tests see if there is a significant association between two categorical variables

The chi square test of independence is a type of chi square test that does this through observed frequencies and expected frequencies of the two variables interacting


Logistic regression uses binary outcomes (yes/no)

Provides odds ratio (odds of outcome occuring in group 1 vs group 2)


Generalized Linear Models

Similar to logistic regression but for multiple categories or complex data structure


Chi-Square Assumptions

Sufficiently large sample size for reliable results

Expected frequency should be at least five

Independence of observations (data points do not interfere with eachother)


Chi-Square Test of Independence

Asks: Are two categorical variables independent or associated?

  • So a chi square test takes for example smoking habits and lung cancer, then it compares how one expects lung cancer to be in smokers vs what it actually is

Compares observed and expected frequencies (raw numbers,

  • So, the observed frequency would be 45 people in the study who smoke and have lung cancer, but the expected frequency (what you expect to find if there was no link) was 12. So we say that there was signficiant relationship.