Homework

homework4.Rmd: All answers to the questions, codes and results (figures, tables) should be included in this single file.

  1. Generate the mathematical notations listed in https://www.calvin.edu/%7Erpruim/courses/s341/S17/from-class/MathinRmd.html.

  2. Generate 100 random numbers from uniform distribution ranging from 0 to 10.

  3. Generate 100 random numbers from normal distribution with mean 10 and standard deviation 2.

  4. Coint toss simulation:

  5. Dice rolling simulation:

  6. Based on the mtcars data frame,

  7. Put math expression in figures. Generate a figure for power function . Show the curves for k=0.5, 1, 1.5 in the same figure. In the figure, You should:

    The following codes will get you started. But you need to modify the parameters in the matplot function.

    x = 1:100
    y1 = x^0.5
    y2 = x^1
    y3 = x^1.5
    matplot(x, cbind(y1, y2, y3), type="l", lty=1, log="y", lwd=2)

    I expect to see a figure like the following:


Day 1: Review

Day 2: Random number generator in R

Day 3: Random number generator in R

Day 4: A little bit more advanced R base graphics

Day 5: Review

Review all contents for this week, especially the day 2 and 3 stuff. The simulation question in the homework might be a little complicated. Talk to me if necessary.