+ All Categories
Home > Documents > Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile...

Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile...

Date post: 30-Dec-2015
Category:
Upload: emil-ward
View: 226 times
Download: 2 times
Share this document with a friend
29
Univariate Graphs III • Review • Create histogram from Commands Window. • Multipanel histogram. • Quantile Plots • Quantile-Normal Plots • Quantile-Quantile Plots
Transcript
Page 1: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Univariate Graphs III

• Review

• Create histogram from Commands Window.

• Multipanel histogram.

• Quantile Plots

• Quantile-Normal Plots

• Quantile-Quantile Plots

Page 2: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Histogram from Commands

• From the Command Window typegraphsheet(height=6.4,width=7.5)hist(iris$sepal.length, nclass=10, xlab="sepal.length")

• Graphs from the Commands Window are fixed unless…

• Right click on the histogram and select Convert to Objects.

• Now you can change the axis scales, etc.

Page 3: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

4 5 6 7 8

0

5

10

15

20

25

30

sepal.length

Page 4: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Multipanel Histogram

• In the Iris data window, select sepal.length and then CTRL select variety.

• Using the Graph->Multipanel menu, plot a Histogram.

• Note that under Conditioning Columns, the column list is variety

• Try changing the number of rows and columns in the layout to be 2 by 2

Page 5: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

4.5 5.5 6.5 7.5

sepal.length

0

5

10

15

20

25

0

5

10

15

20

25

0

5

10

15

20

25

Setosa

Versicolor

Virginica

Page 6: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

4.5 5.5 6.5 7.5

sepal.length

0

5

10

15

20

25

Setosa Versicolor

Virginica

Page 7: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Multipanel Histogram for Several Variables

• In the Iris data window, select sepal.width and then CTRL select variety.

• Using the Graph->Multipanel menu, plot a Histogram.

• Select the same Graphsheet as was used for the previous histogram

Page 8: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

4.5 5.5 6.5 7.5sepal.length

01020

01020

01020

Setosa

Versicolor

Virginica

2.0 2.5 3.0 3.5 4.0 4.5sepal.width

01020

01020

01020

Setosa

Versicolor

Virginica

1.0 2.0 3.0 4.0 5.0 6.0 7.0petal.length

01020

01020

01020

Setosa

Versicolor

Virginica

0.1 0.5 0.9 1.3 1.7 2.1 2.5petal.width

0102030

0102030

0102030

Setosa

Versicolor

Virginica

Page 9: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

4.5 5.5 6.5 7.5sepal.length

05

10152025

Setosa Versicolor

Virginica

2.0 2.5 3.0 3.5 4.0 4.5sepal.width

05

10152025

Setosa Versicolor

Virginica

1.0 2.5 4.0 5.5 7.0petal.length

05

10152025

Setosa Versicolor

Virginica

0.1 0.7 1.3 1.9 2.5petal.width

0

10

20

30Setosa Versicolor

Virginica

Page 10: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile Plots

• A Quantile Plot graphs the value of each observation against the fraction of observations that are equal to or less than that observation

where i is the index of the observation in a sorted list from i = 1 to N

N

ifi

5.0−=

Page 11: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile Plot of Sepal Length

graphsheet(height=6.4,width=6.4)

tLength <- length(iris$sepal.length)

plot(c(1:tLength)/tLength,

sort(iris$sepal.length),

xlab = "Fraction Value",

ylab="Sepal Length (cm)")

Page 12: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.
Page 13: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile Plot of Sepal Length

graphsheet(height=6.4,width=6.4)

qqmath(~ sepal.length,

distribution=qunif, data=iris,

aspect=1,

xlab = "Fraction Value",

ylab="Sepal Length (cm)")

Page 14: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.
Page 15: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile Plot of Sepal Length

graphsheet(height=4,width=7.5)

qqmath(~ sepal.length | variety,

distribution=qunif, data=iris,

panel = function(x, y) {

panel.grid()

panel.xyplot(x, y)

},

layout=c(3,1), aspect=1,

xlab = "Fraction Value",

ylab="Sepal Length (cm)")

Page 16: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.
Page 17: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile-Normal PlotUsing Menus

• In the Iris data window, select sepal.length.

• Using the Graph->2D menu, select a Q-Q Plot.

• Right click on the graph, select Position/Size and then set the Aspect Ratio to 1.

Page 18: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

-3 -2 -1 0 1 2 3

Normal Distribution

4

5

6

7

8

sepal.length

Page 19: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile-Normal Plot

graphsheet(height=6.4,width=6.4)

qqnorm(iris$sepal.length, xlab = "Quantiles from Normal Distribution",

ylab = "Quantiles from Sample")

Page 20: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.
Page 21: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile-Normal Trellis Plot

graphsheet(height=6.4,width=6.4)

qqmath(~ sepal.length,

distribution=qnorm, data=iris,

prepanel = prepanel.qqmathline,

panel = function(x, y) {

panel.qqmathline(y, distribution = qnorm)

panel.qqmath(x, y)

},

aspect=1,

xlab = "Normal Distribution",

ylab="Sepal Length (cm)")

Page 22: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.
Page 23: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile-Normal Trellis Plot

graphsheet(height=6.4,width=6.4)

qqmath(~ sepal.length | variety,

distribution=qnorm, data=iris,

prepanel = prepanel.qqmathline,

panel = function(x, y) {

panel.qqmathline(y, distribution = qnorm)

panel.qqmath(x, y)

},

aspect=1, layout=c(2,2),

xlab = "Normal Distribution",

ylab="Sepal Length (cm)")

Page 24: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

5

6

7

Setosa

-2 -1 0 1 2

Versicolor

5

6

7

Virginica

Normal Distribution

Sepal Length (cm)

Page 25: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile-Quantile PlotUsing Menus

• In the Iris data window, select sepal.length.

• CTRL select petal.length

• Using the Graph->2D menu, select a Q-Q Plot.

• Right click on the graph, select Position/Size and then set the Aspect Ratio to 1.

Page 26: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

0 2 4 6 8

sepal.length

0

2

4

6

8

petal.length

Page 27: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

Quantile-Quantile Trellis Plot

graphsheet(height=6.4,width=6.4)

qq(variety ~ sepal.length, data=iris,subset = variety=="Setosa" | variety=="Versicolor",aspect=1)

Page 28: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.
Page 29: Univariate Graphs III Review Create histogram from Commands Window. Multipanel histogram. Quantile Plots Quantile-Normal Plots Quantile-Quantile Plots.

For Thursday

• Read A Tour of Trellis Graphics pp 1-17 (download from the following web page)http://cm.bell-labs.com/cm/ms/departments/sia/project/trellis/software.writing.html

• Reaction papers are due October 3rd.


Recommended