March 2019
Beginner to intermediate
448 pages
13h 14m
English
In this recipe we will first generate some Gaussian numbers and then, using the pnorm() and qnorm() functions, we will calculate the area to the left and to the right of x=2, and get the 90th quantile to plot the density.
vals = rnorm(10000,0,1)
plot(density(vals))abline(v=2,col="red")
print(paste("Area to the left of x=2",pnorm(2,0,1)))print(paste("Area to the right of x=2",1-pnorm(2,0,1)))print(paste("90th Quantile: x value that has 97.72% to the left",qnorm(0.9772,0,1)))
After running ...
Read now
Unlock full access