0.5 +
|
0.4 + +--------+
| | |
0.3 + | |
| | |
0.2 + +-----+ |
| | | |
0.1 + | | +-----------+
| | | | |
0.0 +-----+-----+-----+--+--+-----+--+--+
0 100 200 300 400 500 600
Horizontal Units
The percentage of observations in a bin is represented
by the area of the histogram bar. For the bar over
the interval [200, 350), the area is(350 - 200) * 0.4 = 150 * 0.4 = 60%The horizontal units of the histogram are percent per horizontal unit.
> setwd("C:/workspace")
> getwd( )
[1] "C:/workspace"
> htWtDf <- read.csv("ht-wt.txt")
> print(htWtDf)
Name Height Weight
1 Susan 1.56 61
2 David 1.78 84
3 Julie 1.65 51
n <- c("Susan", "David", "Julie")
h <- c(1.56, 1.78, 1.65)
w <- c(61, 84, 51)
Answer:> htWtDf <- data.frame(Name=n, Height=h, Weight=w) > print(htWtDf) Name Height Weight 1 Susan 1.56 61 2 David 1.78 84 3 Julie 1.65 51You can also input the vectors directly into the dataframe without creating variables for them:
htWtDf <- data.frame(
Name= c("Susan", "David", "Julie"),
Height=c(1.56, 1.78, 1.65),
Weight=c(61, 84, 51))
z <- (x - mean(x)) / sd(x)
> setwd("C:/workspace")
> t <- read.csv("paper-thickness.txt")$Thickness
> z <- (t - mean(t)) / sd(t)
> print(z)
[1] 0.56121951 0.28684553 0.28684553 0.01247154 0.28684553 0.28684553
[7] 0.01247154 0.28684553 1.10996747 -0.26190244 -1.08502438 -0.81065040
[13] -0.53627642 -2.18252031 -0.81065040 2.20746340 0.56121951 1.38434145
[19] -1.35939837 -1.35939837 0.56121951 0.56121951
There is one mild outlier, which is -2.18252031, at index
14.
setwd("C:/workspace")
t <- read.csv("paper-thickness.txt")$Thickness
hist(t)
# Look at the default histogram before
# trying to set the breakpoints of the
# next two histograms
hist(t, breaks=c(0.09, 0.10, 0.11, 0.12))
hist(t, breaks=seq(0.09, 0.12, 0.002))
# Remember, seq(s, e, b)) creates a sequence
# that starts at s, ends at e, and increases
# by b until it reaches e.