
115Exploratory Analysis and Introduction to Inferential Statistics
# standardize observations before plot
z <- (x-mean(x))/sd(x); plot(ecdf(z))
# plot theoretical standard normal N(0,1)
Z <- seq(-4,+4,0.1); lines(Z, pnorm(Z,0,1),lwd=2)
See Figure 4.4b. In the graph, we can see how well or not the cdf of the data (the empirical cdf) fol-
lows the expected or theoretical cdf for the normal distribution.
4.8.5 functions
We can enhance existing R functions by creating additional functions. When we develop a program
into a function with proper arguments, it will allow using the program without rewriting all the
statements. One can edit a function in a ...