Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous...

16
Thinking about Graphics Scales in Stata

Transcript of Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous...

Page 1: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Thinking about Graphics

Scales in Stata

Page 2: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Level of measurement

• Categorical versus continuous

• Categorical data may be represented as• Position along a categorical axis• Aesthetics such as color, marker type• Paneling

• Continuous data may be represented as• Position along a continuous axis• Aesthetics such as color, marker size

Page 3: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Categories as axes

010

2030

4050

freq

uenc

y

Domestic Foreign

graph bar

0 10 20 30 40 50frequency

Foreign

Domestic

graph hbar

010

2030

4050

Fre

quen

cy

Domestic ForeignCar type

histogram foreign, discrete

Dom

estic

For

eign

Car

type

0 10 20 30 40 50Frequency

dotplot foreign

Categorical axis

Page 4: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Categories as aesthetics

0 20 40 60 80 100percent

graph hbar, asyvars stack

Domestic ForeignDomestic Foreign

graph pie

Categories as color

Page 5: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Bivariate category axes & aesthetics

010

2030

40pe

rcen

t

Domestic Foreign

1 2 3 4 5 1 2 3 4 5

graph bar, over() over()

010

2030

40pe

rcen

t

Domestic Foreign

graph bar, over() asyvars

020

4060

80pe

rcen

t

Domestic Foreign

graph bar, asyvars stack

0

25

50

75

100

perc

ent b

y R

epai

r R

ecor

d 19

78

0 25 50 75 100percent by Car type

Domestic ForeignCar type

spineplot (user-written)

Two categorical variables

Page 6: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Bivariate category paneling

Domestic Foreign

Graphs by Car type

010

2030

1 2 3 4 5 1 2 3 4 5

Domestic Foreign

Fre

quen

cy

Repair Record 1978Graphs by Car type

12

34

5R

epai

r R

ecor

d 19

78

Domestic ForeignCar type

dotplot, over()

Categories by paneling

Page 7: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Univariate continuous axis

1020

3040

Mile

age

(mpg

)0 2 4 6 8 10

Frequency

dotplot

02

46

810

Fre

quen

cy

10 20 30 40Mileage (mpg)

histogram, discrete

1020

3040

Mile

age

(mpg

)

0 20 40 60 80index

scatter vs. index

Univariate continuous axes

Page 8: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Bivariate continuous axes

1020

3040

Mile

age

(mpg

)

0 20 40 60 80index

scatter vs. sorted index

1020

3040

Mile

age

(mpg

)

0 5,000 10,000 15,000Price

scatter

Bivariate continuous axes

Page 9: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Summary (continuous) by category

02,

000

4,00

06,

000

mea

n of

pric

e

1 2 3 4 5

graph bar

0 2,000 4,000 6,000mean of price

5

4

3

2

1

graph dot

0 2,000 4,000 6,000 8,000mean of price

5

4

3

2

1

Domestic Foreign

Mean price by category

Page 10: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Scatter by category

1020

3040

5,000 10,000 15,000 5,000 10,000 15,000

Domestic Foreign

Mile

age

(mpg

)

PriceGraphs by Car type

1020

3040

0 5,000 10,000 15,000Price

Color and symbol

Scatter by category

Page 11: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Coordinates

• Systems• Cartesian, mostly• Polar, for pie

• Dimension• 2 to 4, as an overlay

• Order• Category order• Continuous order, forward or reversed

• Measurement units• Linear, the usual• Log

Page 12: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Cartesian and polar

Page 13: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Layering

Page 14: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Layering, continuous

05,

000

10,0

0015

,000

0 50 100 150 200 250

Price Weight (lbs.)

2,00

03,

000

4,00

05,

000

Wei

ght (

lbs.

)

05,

0001

0,00

015,

000

Pric

e

0 50 100 150 200 250Mileage (mpg)...

Price Weight (lbs.)

2,00

03,00

04,00

05,00

0W

eigh

t (lb

s.)

05,

00010

,00015

,000

Pric

e

140 160 180 200 220 240Length (in.)

10 20 30 40Mileage (mpg)

Price Weight (lbs.)

Superimposed coordinates

Page 15: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Layered, categorical

0 10 20 30 40 50

Linc.Peugeot

Cad.VolvoMerc.BuickOlds

Pont.Audi

DodgeAMCFiat

Chev.Toyota

FordBMW

DatsunRenault

Plym.Honda

VWMazda

Subaru

mean of mpg mean of weight100

SubaruMazda

VWHondaPlym.

RenaultDatsun

BMWFord

ToyotaChev.

FiatAMC

DodgeAudi

Pont.Olds

BuickMerc.VolvoCad.

PeugeotLinc.

2,000 2,500 3,000 3,500 4,000 4,500lbs.

10 15 20 25 30 35mpg

mean mpg mean weight

Layered dot plots

Page 16: Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.

Order, categorical

0 10 20 30 40mean of mpg

VolvoVW

ToyotaSubaruRenault

Pont.Plym.

PeugeotOlds

Merc.Mazda

Linc.Honda

FordFiat

DodgeDatsunChev.Cad.

BuickBMWAudiAMC

0 10 20 30 40mean of mpg

Linc.Peugeot

Cad.VolvoMerc.BuickOlds

Pont.Audi

DodgeAMCFiat

Chev.Toyota

FordBMW

DatsunRenault

Plym.Honda

VWMazda

Subaru

Reorder categorical coordinates