Categorical data Professor Jarad Niemi STAT 226 - Iowa State - - PowerPoint PPT Presentation

categorical data
SMART_READER_LITE
LIVE PREVIEW

Categorical data Professor Jarad Niemi STAT 226 - Iowa State - - PowerPoint PPT Presentation

Categorical data Professor Jarad Niemi STAT 226 - Iowa State University August 28, 2018 Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 1 / 19 Outline Distribution, frequency table Bar chart Pareto chart Pie chart


slide-1
SLIDE 1

Categorical data

Professor Jarad Niemi

STAT 226 - Iowa State University

August 28, 2018

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 1 / 19

slide-2
SLIDE 2

Outline

Distribution, frequency table Bar chart Pareto chart Pie chart Mode and median Contingency table

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 2 / 19

slide-3
SLIDE 3

Categorical data

Distribution and frequency tables

Definition The distribution of a variable is the collection of possible values the variable can take and how often each value occurs. Definition A frequency table is a summary that shows the distribution of a variable. For categorical variables, we can use the following to understand the distribution of a variable: frequency table, bar chart, Pareto chart, pie chart, mode, median, and contingency table.

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 3 / 19

slide-4
SLIDE 4

Categorical data

Majors

Major College Clsfn.Year 1 P BUS M 3 2 P BUS M 3 3 AG B A 2 4 MKT M 2 5 ACCT M 2 6 P BUS M 2 7 ACCT M 2 8 AG B A 3 9 BUS U M 2 10 P BUS M 2

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 4 / 19

slide-5
SLIDE 5

Categorical data

Majors summary

Major College Clsfn.Year P BUS :65 A:25 Min. :1.000 AG B :24 H: 1 1st Qu.:2.000 ACCT : 3 M:74 Median :2.000 MKT : 3 S: 1 Mean :2.485 BUS U : 2 3rd Qu.:3.000 A M D : 1 Max. :4.000 (Other): 3

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 5 / 19

slide-6
SLIDE 6

Categorical data

Recode Year

Major College Clsfn.Year Year P BUS :65 A:25 Min. :1.000 Freshman : 2 AG B :24 H: 1 1st Qu.:2.000 Sophomore:54 ACCT : 3 M:74 Median :2.000 Junior :39 MKT : 3 S: 1 Mean :2.485 Senior : 6 BUS U : 2 3rd Qu.:3.000 A M D : 1 Max. :4.000 (Other): 3

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 6 / 19

slide-7
SLIDE 7

Categorical data Frequency table

Frequency table

Majors:

A M D ACCT AG B AN S BUS U ECON FIN MKT P BUS 1 3 24 1 2 1 1 3 65

College:

A H M S 25 1 74 1

Year:

Freshman Sophomore Junior Senior 2 54 39 6

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 7 / 19

slide-8
SLIDE 8

Categorical data Bar chart 20 40 Freshman Sophomore Junior Senior

Year count

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 8 / 19

slide-9
SLIDE 9

Categorical data Bar chart 20 40 Freshman Sophomore Junior Senior

Year count Year

Freshman Sophomore Junior Senior Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 9 / 19

slide-10
SLIDE 10

Categorical data Bar chart Freshman Sophomore Junior Senior 20 40

count Year

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 10 / 19

slide-11
SLIDE 11

Categorical data Bar chart 0.0 0.2 0.4 Freshman Sophomore Junior Senior

Year prop

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 11 / 19

slide-12
SLIDE 12

Categorical data Bar chart 20 40 60 A M D ACCT AG B AN S BUS U ECON FIN MKT P BUS

Major count

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 12 / 19

slide-13
SLIDE 13

Categorical data Pareto chart 20 40 60 P BUS AG B ACCT MKT BUS U A M D AN S ECON FIN

Major count

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 13 / 19

slide-14
SLIDE 14

Categorical data Pie chart 25 50 75 0/100 1

Percentage factor(1) Major

P BUS AG B ACCT MKT BUS U A M D AN S ECON FIN Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 14 / 19

slide-15
SLIDE 15

Categorical data Pie chart

Arguments against pie charts

https://www.darkhorseanalytics.com/blog/salvaging-the-pie

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 15 / 19

slide-16
SLIDE 16

Categorical data Pie chart Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 16 / 19

slide-17
SLIDE 17

Categorical data Mode

Mode

Definition The mode is the most common value. The mode may not be unique.

P BUS AG B ACCT MKT BUS U A M D AN S ECON FIN 65 24 3 3 2 1 1 1 1 A H M S 25 1 74 1 Freshman Sophomore Junior Senior 2 54 39 6

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 17 / 19

slide-18
SLIDE 18

Categorical data Median

Median

Definition The median of an ordinal variable is the middle value when the values are

  • rdered.

[1] Freshman Freshman Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore [12] Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sopho [23] Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sopho [34] Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sopho [45] Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sophomore Sopho [56] Sophomore Junior Junior Junior Junior Junior Junior Junior Junior Junior Junior [67] Junior Junior Junior Junior Junior Junior Junior Junior Junior Junior Junio [78] Junior Junior Junior Junior Junior Junior Junior Junior Junior Junior Junio [89] Junior Junior Junior Junior Junior Junior Junior Senior Senior Senior Senio [100] Senior Senior Levels: Freshman Sophomore Junior Senior Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 18 / 19

slide-19
SLIDE 19

Categorical data Contingency table

Contingency table

Definition A contingency table shows the distribution of one variable in the rows and another in the columns.

Year Major Freshman Sophomore Junior Senior P BUS 2 33 27 3 AG B 12 10 2 ACCT 2 1 MKT 3 BUS U 2 A M D 1 AN S 1 ECON 1 FIN 1

Professor Jarad Niemi (STAT226@ISU) Categorical data August 28, 2018 19 / 19