Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
3.6 Exercises 49 23 24 25 26 27 28 29 30 text( sdval , .9*max(y) , bquote( paste(Delta , "x = " ,.(dx)) ) , adj = c(0,.5) ) text( sdval , .8*max(y) , bquote( paste( sum(,x,) , " " , Delta , "x p(x) = " , .(signif(area,3)) ) ) , adj = c(0,.5) ) # Save the plot to an EPS f{i}le. dev.copy2eps( f{i}le = "IntegralOfDensity.eps" ) 3.6 EXERCISES Exercise 3.1. [Purpose: To give you some experience with random number generation in R.] Modify the coin-flipping program in Section 3.5.1 ( RunningPropor- tion.R ) to simulate a biased coin that has p(H) = 0.8. Change the height of the reference line in the plot to match p(H). Comment your code. Hint: Read the help for sample . Exercise 3.2. [Purpose: To have you work through an example of the logic presented in