Master Probability Theory and Statistical Simulation ๐ฏ
Welcome to Week 4! This week, we explore probability theory and sampling techniques - essential foundations for statistical inference in agricultural research. Learn to simulate probability experiments, work with distributions, and understand randomness!
Click the "Launch Week 4" button above to start your R environment. This will take 2-5 minutes to load with all necessary packages for probability and sampling.
Once Binder loads, you'll see the Jupyter Notebook interface. In the left panel, you'll see:
assignment/ - Assignment 4 on probability simulationclass_activity/ - Week 4 lab tutorialClick on the class_activity folder to access this week's content.
Inside the class_activity folder, double-click on Week4_Probability_Sampling.ipynb to open the interactive lab notebook.
This week we'll work with simulated data and probability distributions! The notebook will guide you through:
Use these interactive tools to understand probability concepts before working with R code:
๐ก Tip: Use these tools to visualize probability concepts before applying them in your R notebook!
sample(x, size, replace = TRUE/FALSE) # Random samplingset.seed(number) # Reproducible resultstable(data) # Frequency countssum(logical_vector) # Count TRUE valueslength(data) # Total observations
rnorm(n, mean = 0, sd = 1) # Generate random normal datapnorm(q, mean = 0, sd = 1) # Calculate probabilitiesqnorm(p, mean = 0, sd = 1) # Find quantilespnormGC(q, mean, sd, graph = TRUE) # Visual probability (tigerstats)
as.numeric(x) # Convert to numericas.character(x) # Convert to characteras.factor(x) # Convert to factoras.logical(x) # Convert to logicaldata.frame(x) # Convert to data frame
From the main directory, click on the assignment folder to access Assignment 4.
Double-click on Assignment4.ipynb to open your assignment on probability simulation.
Simulate 50 coin flips and 50 dice rolls
Calculate experimental probabilities and compare to theoretical
Create probability distributions and bar plots
The assignment focuses on fundamental probability concepts:
Learn to work with discrete probability distributions and understand sampling variability!
โ ๏ธ Important: Binder environments are temporary! Always save your work locally.
When you're done working, save your progress:
To resume your work:
.ipynb fileFor Assignment 4, submit TWO files to UC Davis Canvas:
Your completed assignment with all outputs and analysis
Your notebook code as backup
Due Date: Check Canvas for assignment deadline
By the end of this week, you will be able to:
Mohammadreza Narimani
๐ง mnarimani@ucdavis.edu
๐ซ Department of Biological and Agricultural Engineering, UC Davis
?function_name for help with functionsClick the Binder badge below to launch Week 4!
Happy probability exploring! ๐ฒ๐พ