R Scripts and Projects

The R Projects consist of html files with the output from running R scripts in RStudio. Using a web browser, these files detail various applications of R in the course.

Interested readers may download the compressed (zipped) folders and replicate the R / RStudio computations on their own computer.

The following instructions apply to executing R scripts in the first R Project. For all other R Projects, follow the same instructions (skipping step 1) replacing “rproject1.zip” with the corresponding compressed (zipped) folder for that project.

  1. Download / Install R and the Rstudio desktop on your computer



  1. Download the compressed folder for the R Project (“rproject1.zip” for Project 1) to your computer and extract the project directory, e.g., “rproject1” (for Project 1).
  2. Start the R-Studio application. From the top bar of commands
    • select “File”, then “New Project …”, then for the “Create Project from” option select “Create Project from Existing Directory”
    • with the browser that appears, navigate to select the extracted directory “rproject1” (for Project 1, or “rproject2” for Project 2, etc.)
  3. The R-Studio application opens with a 4-panel display. The lower left panel is a console for typing R commands directly or viewing output from executed R commands. The lower right panel has tabs [Files|Plots|Packages|Help]. In the lower right panel, select the Files tab and open one of the R Script files, e.g., for Project 1 select the file “Rproject1_script1.r” by clicking on the file name. The file will open in new tab in the top left panel.
  4. Go to the file in the top left panel: Rproject1_script1.r. Execute the script file by either pressing the “Source” button at the top tool bar of the file window, or highlighting commands in the file and typing Control-Enter or Control-r. The html file in the project directory can be re-created (compiled) by pressing the “notebook” icon at the middle of the top bar of the top-left script window. The html file is easily viewed in a web browser and documents the R commands and output from executing the R script.
  5. To exit R-Studio, either type: q() # at the console, or select “File / Quit R” from the Tool Bar at the top of R-Studio. (It asks you to type “n” or “y” to not-save or save the workspace “.RData”. You can type “n” since the scripts are designed to load relevant R workspaces explicitly; typing “y” will save any objects you might have created in the R workspace.)

Note: When you restart R-Studio, the application should open automatically with the same panel of open files.

L1 R Project 1: Distributions Derived from the Normal Distribution R Project 1 (ZIP) (This file contains: 1 .r file.)

R Project 2: LeCam-Neyman Precipitation Data (MOM Estimation of Gamma)

R Project 2: LeCam-Neyman Precipitation Data (MOM with MLE)

R Project 2 (ZIP) (This file contains: 2 .r files.)

R Project 3: Hardy Weinberg Model / Rayleigh Distributions

Maximum Likelihood Estimates of Multinomial Cell Probabilities

ML and MOM Estimates of Rayleigh Distribution Parameter

Multinomial Simulation

Poisson Prussian Cavalry


R Project 3 (ZIP) (This file contains: 3 .r files.)

R Project 4: Bayesian Estimation

Bayesian Hardy Weinberg

Bayesian Poisson

R Project 4 (ZIP) (This file contains: 2 .r files.)

R Project 5: Hypothesis Testing

Problem 9_11_1 and 6

Problem 9_11_3

Problem 9_11_7

R Project 5 (ZIP) (This file contains: 4 .r files.)

R Project 6: Hypothesis Testing II

LRTest Hardy Weinberg

LRTest Poisson

R Project 6 (ZIP) (This file contains: 2 .r files.)

R Project 7: Assessing Goodness of Fit



R Project 7 (ZIP) (This file contains: 6 .r files.)

R Project 8: Summarizing Data

Problem 10_9_26



Bootstrap Location


R Project 8 (ZIP) (This file contains: 5 .r files.)

R Project 9: Regression Analysis of CAPM

FM Casestudy_1_0_Download Data

FM Casestudy_1_1_CAPM

R Project 9 (ZIP) (This file contains: 2 .r files.)

R Project 10: Polynomial Regressions and Weighted Regressions

Problem 14_9_39

Flow Occ Regressions

R Project 10 (ZIP) (This file contains: 3 .r files.)

R Project 11: Multiple Comparisons and ANOVA

Tablets One Way Anova

Tablets Two Sample T

R Project 11 (ZIP) (This file contains: 2 .r files.)

R Project 12: Chi-square Tests and Fisher’s Exact Test

R Project 12 (ZIP) (This file contains: 2 .r files.)

Course Info

Learning Resource Types

assignment_turned_in Problem Sets with Solutions
notes Lecture Notes
group_work Projects