Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graphics in S-Plus Jagdish S. Gangolly School of Business

Similar presentations


Presentation on theme: "Graphics in S-Plus Jagdish S. Gangolly School of Business"— Presentation transcript:

1 Graphics in S-Plus Jagdish S. Gangolly School of Business
State University of New York at Albany 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

2 Acc 522 Statistical Methods for Business Decisions (J Gangolly)
Trellis Graphics I A matrix of graphs Example: >par(mfrow=c(2,2)) # 2 X 2 matrix of figures >x <- 1:100/100:1 >plot(x) # plot cell (1,1) >plot(x, type=“l”) # plot cell (1,2) line >hist(x) # plot cell (2,1) histogram >boxplot(x) # plot cell (2,2) boxplot 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

3 Acc 522 Statistical Methods for Business Decisions (J Gangolly)
Trellis Graphics II Syntax: Dependent variable ~ explanatory variable |conditioning variable, Data set 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

4 Acc 522 Statistical Methods for Business Decisions (J Gangolly)
Trellis Graphics III Example: histogram(~height | voice.part, data=singer) No dependent variable for histogram 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

5 Trellis Graphics IV: Singer Data
Height is explanatory variable Data set is singer 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

6 Trellis Graphics V: Barley data
12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

7 Trellis Graphics VI: Sunspots v. Time
12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

8 Trellis Graphics VI: CO2 levels
12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

9 Trellis Graphics VII: Scatterplots
12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

10 Acc 522 Statistical Methods for Business Decisions (J Gangolly)
Graphics I: Summary > summary(barley) yield variety year site Min.: Svansota,No.462: :60 Grand Rapids:20 1st Qu.: Manchuria: :60 Duluth:20 Median: No. 475: University Farm:20 Mean: Velvet,Peatland: Morris:20 3rd Qu.: Glabron: Crookston:20 Max.: No. 457: Waseca:20 Wisconsin No. 38,Trebi:24 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

11 Graphics II: Stem and Leaf Display
attach(barley) > stem(yield) N = Median = Quartiles = 26.85, Decimal point is 1 place to the right of the colon 1 : 4 1 : 579 2 : 2 : 3 : 3 : 4 : 4 : 5 : 00 5 : 5889 6 : 4 6 : 6 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

12 Graphics III: Quantiles
> quantile(yield, seq(0.1, 0.9, by=0.1)) 10% 20% 30% % % % % 80% % > > quantile(yield, c(0.25, 0.5, 0.75)) 25% % 75% 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

13 Acc 522 Statistical Methods for Business Decisions (J Gangolly)
Graphics IV: tapply > tapply(yield, list(site, year), mean) Grand Rapids Duluth University Farm Morris Crookston Waseca 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

14 Acc 522 Statistical Methods for Business Decisions (J Gangolly)
Graphics V: by by(barley, year, summary) year:1932 yield variety year site Min.: Svansota,No. 462: :60 Grand Rapids:10 1st Qu.: Manchuria: : Duluth:10 Median: No. 475: University Farm:10 Mean: Velvet,Peatland: Morris:10 3rd Qu.: Glabron: Crookston:10 Max.: No. 457: Waseca:10 Wisconsin No. 38,Trebi:12 year:1931 yield variety year site Min.: Svansota,No. 462: : Grand Rapids:10 1st Qu.: Manchuria: : Duluth:10 Median: No. 475: University Farm:10 Mean: Velvet,Peatland: Morris:10 3rd Qu.: Glabron: Crookston:10 Max.: No. 457: Waseca:10 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

15 Graphics VI: histogram
> histogram(~yield) 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

16 Graphics VII: histogram in trellis
> histogram(~yield | site) 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

17 Graphics VIII: Box-and-Whiskers Plot
The boxplot is interpreted as follows: The box itself contains the middle 50% of the data. The upper edge (hinge) of the box indicates the 75th percentile of the data set, and the lower hinge indicates the 25th percentile. The range of the middle two quartiles is known as the inter-quartile range. The line in the box indicates the median value of the data. If the median line within the box is not equidistant from the hinges, then the data is skewed. The ends of the vertical lines or "whiskers" indicate the minimum and maximum data values, unless outliers are present in which case the whiskers extend to a maximum of 1.5 times the inter-quartile range. The points outside the ends of the whiskers are outliers or suspected outliers. 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

18 Graphics IX: Box-and-Whiskers Plot
bwplot(site~yield | year, data=barley) 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

19 Graphics X: Box-and-Whiskers Plot in Trellis Graphs
bwplot(year~yield | site, data=barley) 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)

20 Acc 522 Statistical Methods for Business Decisions (J Gangolly)
Graphics X: Persp > attach(geyser) > persp(hist2d(waiting, duration)) 12/4/2018 Acc 522 Statistical Methods for Business Decisions (J Gangolly)


Download ppt "Graphics in S-Plus Jagdish S. Gangolly School of Business"

Similar presentations


Ads by Google