Piotr Bialas  Introductory Statistics with R

  • Welcome
  • Histogram 1
    • Histogram 2
    • How to Create a Histogram in R?
    • Histogram 3
  • Chapter 0
    • Chapter 1
    • Chapter 2.1
    • Chapter 2.2
    • Chapter 2.3
    • Chapter 2.4
  • Assignments
    • Extra Credit 1
  • Binomial Distr.
  • StandardND
  • Welcome
  • Histogram 1
    • Histogram 2
    • How to Create a Histogram in R?
    • Histogram 3
  • Chapter 0
    • Chapter 1
    • Chapter 2.1
    • Chapter 2.2
    • Chapter 2.3
    • Chapter 2.4
  • Assignments
    • Extra Credit 1
  • Binomial Distr.
  • StandardND

Chapter 2.4

How to create basic plots in R?

Cumulative Frequency Histogram of Brain Volumes and Corresponding Ogive?

Brain Volume Data1

1005, 963,1035,1027,1281,1272,1057,1079,1034,1070,1173,1079,1067,1104,1347,1439,1029,1100,1204,1160

We will graph frequency distribution histogram of brain volumes first …

Volume <- c(1005,963,1035,1027,1281,1272,1057,1079,1034,1070,1173,1079,1067,1104,1347,1439,1029,1100,1204,1160)
n <-100
## You may want to try different values for n; n=25,50,200 
breaks =seq(899.5,1499.5,by=n)
Volume.cut=cut(Volume,breaks,right = FALSE)
Volume.freq=table(Volume.cut)
h <-hist(Volume,breaks,col="green",border="blue")

h$counts <-cumsum(h$counts)
plot(h,col="red",border = "blue",main="Cumulative Histogram of Brain Volumes")

Volume <- c(1005,963,1035,1027,1281,1272,1057,1079,1034,1070,1173,1079,1067,1104,1347,1439,1029,1100,1204,1160)
breaks =seq(899.5,1499.5,by=n)
Volume.cut=cut(Volume,breaks,right = FALSE)
Volume.freq=table(Volume.cut)
cumfreq0 <-c(0,cumsum(Volume.freq))
plot(breaks,cumfreq0,xlab="Volume",ylab = "Cumulative Frequency",
     main = "Cumulative Frequency of Brain Volume", col="red")
lines(breaks,cumfreq0,col="blue")

References2


  1. Data Set 6: Extracted from M.F Triola, Essential s of Statistics Fifth Edition, Pearson. Originally provided by M.J. Tramo,W.C. Loftus, T.A. Stukel, J. B. Weaver, M.S. Gazzinga. See “Brain Size, Head Size, and IQ in Monozygotic Twins”, Neurology, Vol. 50.↩

  2. influentialpoints.com, Beginners statistics: cumulative plot↩

Powered by Create your own unique website with customizable templates.