This is the course website for MATH 350 - Introduction to Probability and Statistics course taught by Dr. Robin Donatello in Fall 2021 at California State University, Chico. This landing page is used for posting of regular announcements and information for students of the class.

11-03-2021 Week 15: Estimating Probabilities and distributions

We’re going to close out the semester by practicing estimating probabilities from known distributions using simulation. Technically no new conceptual material will be presented, we will be looking at new applications of prior material.

Important Updates

  • Student Office hours on Wednesday 12/2 is moved to 2pm
  • Exam 2 Take home credit recovery:
    • request regrade through gradescope
    • Full credit back for the “choosing the correct distribution” rubric item
  • Blackboard Gradedbook fully up to date and represents grade earned to date.
    • Yes you can still turn in late homework
    • Yes you can still come to office hours or community coding.
  • Hw for Chapter 5 is ready. It’s a long assignment, spanning 2 weeks of material that we will be spending time in class on, and is worth 30 pts.

New R/Markdown Tip(s)

  • The table function creates a frequency table for a vector. A frequency table is a table of possible values in the sample space, and the number of times those occur.
  • The prop.table function takes a table object as it’s argument, and converts the frequencies to relative percentages. This is how we get probability estimates, and an estimate of the pmf.
x <- sample(1:4, 10, replace=TRUE)
## x
## 1 2 3 4 
## 4 2 1 3
## x
##   1   2   3   4 
## 0.4 0.2 0.1 0.3

11-03-2021 Week 13: The Normal, Exponential & Uniform Distributions


  • We didn’t have as many quizzes as expected, and I’ve combined some of the chapter homeworks into a single submission. This is unintentionally increasing the weight of the exams on your final grade, so I am adjusting the points of the combined homework starting with 4.2 & 4.3.
    • I have also combined 4.4 & 4.5 so if you started this already please redownload the template to get the questions from 4.5
    • The number of items graded per assignment will increase to reflect the increase in assignment length.
  • The Blackboard Learn Gradebook is complete with columns for every remaining graded item. You can now do any of the potential “what if” grade calculations you are interested in. Be sure to cross reference the syllabus to account for dropped quizzes and homework assignments.

New R/Markdown Tip(s)

Drawing Normal Distributions

We’re going to draw a lot of pictures, so let’s create a function to draw and shade the standard normal distribution

shade.norm <- function(mu, sigma, from, to){
  x = seq(mu-3*sigma, mu+3*sigma, by = 0.1) # set range for x as mu - 3*sigma to mu + 3*sigma
  p.x = dnorm(x, mu, sigma)                 # calculate p(x) in that range
  want.x  <- seq(from, to, by=.01)          # set range for shaded region
  want.px <- dnorm(want.x, mu, sigma)       # calculate p(x) for that region

  # create the density plot
  ## bty="n" turns off outer box, axes=F turns off axes labels, ylab="" turns off y axis label
  plot(x = x, y = p.x, type="l", bty="n", axes=F, ylab="") 
  # Specify axis ticks at mu +/- 3 sigma
  axis(1, at=c(c(mu-1:3*sigma, mu, mu+1:3*sigma)))
  polygon(c(from, want.x, to),            # set range of x to shade
          c(0, want.px, 0),               # set range of y to shade (always start and end at 0)
          col="lightgreen")               # add a color to the shade 

10-28-2021 Week 12: Expected Value & Variance for continuous distributions.

We’re revisiting topics such as expected value and variance, but on continuous distributions. Keep in mind all the same properties of expectation, independence and variance apply!

New R/Markdown Tip(s)

  • Symbol for infinity in \(\LaTeX\): \infty and -\infty.
  • Infinity in R: Inf
  • \(e^{1}\) in R: exp(1)
  • The results from the integrate function is complex. To access the numeric answer use $value after the saved object.
    • Example: result <- integrate(f(x), lower=0, upper=1). The numeric answer can be accessed using result$value

10-22-2021 Week 11: Exam 2

Don’t forget that coming to community coding or office hours to get help or to check in on your learning progress is part of your grade!

10-16-2021 Week 10: Finishing discrete distributions & starting continuous distributions

New R/Markdown Tip(s)

Writing integrals in \(\LaTeX\). Using the first example in Ch 4.1 as an example:

$$ \int_{0}^{1} 4y^{3} dy = y^{4} \Biggr|_{0}^{1}$$ resolves as

\[ \int_{0}^{1} 4y^{3} dy = y^{4} \Biggr|_{0}^{1}\]

Calculating finite integrals in R:

  1. Define a function:
integrand <- function(y){4*y^3}
  1. Use the integrate function on the integrand with lower and upper bounds specified.
## 1 with absolute error < 1.1e-14

10-10-2021 Week 9: Functions of random variables

Thank you again for your patience with my excessive long time in getting your take home exams graded. I wanted to share some comments & feedback, along with my rubric and what comes next.

Rubric Scores

Credit Recovery

Wrapping up Chapter 3 this & next week. That means Exam 2 is likely the 1st week of November.

New R/Markdown Tip(s)

  • Variable definitions and code “speak” to each other across code chunks. Consider writing your comments outside code chunks instead of inside them. That way they will word wrap and both you and I can see all of your explanation.
  • RStudio has a nice visual editor to help you see what your compiled document will look like, and to help you with making your work more nicely formatted. See here for more information.
    • Also has help for technical writing such as LaTeX
  • Look back at week 3 for a nice way to align your formulas in LaTeX
  • Write the binomial formula in LaTeX:
  • The “is distributed as” tilde (\(\sim\)) in latex is written as \sim
  • Writing tables in Markdown can be tricky. Here are some advice:

10-04-2021 Week 8: Binomial & Geometric Probability Distributions

This week is devoted to exploring two special types of discrete probability distributions.

New R/Markdown Tip(s)

If you have a vector of integer or discrete values, you can create a frequency table using the table() function, and convert that into a table of proportions using prop.table().

pX <- c(.1, .2, .5, .3)
X <- sample(1:4, size=100, replace=TRUE)
## X
##  1  2  3  4 
## 28 22 24 26
## X
##    1    2    3    4 
## 0.28 0.22 0.24 0.26
  • The function mean() calculates the mean of a vector.
  • The function var() calculates the variance of a vector.

10-04-2021 Week 7: Probability Distributions

Update 10/6: Due dates for Hw 2.4, 3.1 and 3.2 have been adjusted.

We’ve hinted before about the idea that we’re not typically interested in the probability of an event occurring in a single experiment, but more of what’s the expected probability of the event “in the long run”.

Think about each simulation you’ve run for this class. Each time you run it, you get a different result. If you ran your simulation many many times, you would end up with many different results - all similar but they do vary. You’ll be creating a distribution of values.

And so that’s what were looking at next. What are random variables, what is the distribution of some random variables, what characteristics of that distribution make them special, and where do we see these distributions occur in real life.


  • I will be out of town Friday and Monday. Kathy Gray will be guest lecturing for me.
  • Extra student hours this week
    • Monday 10-11 Holt 202 (or via zoom if needed)
    • Tuesday 4-5pm Zoom - Use link in Blackboard Learn
    • Thursday 11-12am Zoom - Use link in Blackboard Learn.
  • Exam 1 grading status
    • In person exam 3/4 done. Will hand back by Wednesday
    • Take home exam compiled. If you have a 0 in BBL you need to submit the RMD to me.
    • Exam Error Analysis - Due before Exam 2: This is a chance for you to analyze the types of errors you made on exam 1 (both take home and in person) and see where you have room for improvement. You can then re-work every missed problem on a separate paper, make an appointment with me to go over your corrections and earn back all of the points missed. You must fill out this linked form and try to rework your exam before you meet with me.
  • Homework info
    • Ch 2.4 assignment has 8 questions. At least 6 is required to be considered “full credit” in the grading rubric.
    • Ch 3 has short sections - homework is posted for 3.1 and 3.2 and is due within a few days after we complete that section. Assignments will start moving fast, do your best not to fall behind and don’t wait to ask questions when you get stuck.

New R/Markdown Tip(s)

Multiplication using a single * in R is done element wise.

c(2,4,6) * c(1,3,5)
## [1]  2 12 30

If we wanted to then add those elements of the resulting vector together, we could use the sum() function:

sum(c(2,4,6) * c(1,3,5))
## [1] 44

This process is known as Vector multiplication (also known as the product of two vectors, or the dot product) can be done using the %*% operator. This is used in the formula for the expectation of a random variable.

c(2,4,6) %*% c(1,3,5)
##      [,1]
## [1,]   44

09-27-2021 Week 6: Exam 1, Counting Arguments.

Here is the overview for the week.

New R/Markdown Tip(s)

  • R and R Studio cheatsheets are available here:
  • Some useful functions:
    • max(a, b) takes the max value between objects a and b. If a is a vector, max(a) will find the max value within that vector.
    • length() returns the number of elements in a vector. Like nrow for a matrix (which doesn’t work on 1 dimensional vectors)
    • unique() removes duplicate values in a vector. For example if x <- c(1,2,2,3,3,3), then distinct(x) returns the vector 1,2,3.

09-20-2021 Week 5: Law of Total Probability and Bayes Rule


You can request regrades in Gradescope? Learn how to request one here.

I will honor regrade requests up until the first exam for any/all homework questions that have a rubric applied. If you did not get the grade you wanted,

  1. review your score to see where you missed points.
  2. Adjust your code (make sure it works)
  3. In the regrade request paragraph, paste your updated code.

I will run your code on my computer, and if your revision addresses the points that you missed, I will update your score.

09-13-2021 Week 4: Conditional Probability & Independence

Wed update

  • Watch the video on independent events before Friday. Fill out your course packet page 24. We will skip lecture and work through examples on page 25 and 26 on friday.

  • Turn in your homework! I would rather have you turn in your homework late than not at all. I will accept late homework (for a 1 pt penalty) up until the grading is finalized & entered into BBL. Homework 2.1 has been graded, but I will hold off until Tuesday to enter it into BBL. So get your homework turned in! I’ve modified the late date in Gradescope to show Monday midnight.

  • Now may be a good time to remind everyone of the class policy on collaboration vs cheating.

    • I for sure want you working together on the HW, but turning in near carbon copies of your homework files crosses the boundary into cheating. This harms your individual learning and starts to create distrust when independent work is mandated such as exams and quizzes.
  • ESTIMATED dates for HW2.3 and Exam 1 are on the calendar & schedule. (Not sure yet if we’re going to put Ch2.4 on the first exam)

  • After we wrap up simulation on Monday by seeing how repeating experiments many times gives you a better approximation of the theoretical probability, we return to thinking about probability and introduce the concept of conditional probability and the meaning of mathematical independence

  • Homework solutions for HW1 have been posted on the schedule page. Solutions for 2.1 will be posted shortly, after grading for 2.1 is finalized.

  • Heads up, if you are not using the Speegle textbook as another learning reference, you are missing out big time. I am here to help guide your learning and direct you from one topic to the next in a sensible manner, but we don’t have enough face to face time (nor do you want to listen to me drone on for that long) to cover everything. Always use the textbook for more/additional examples, to fill in the gaps in your course packet.

  • HW 2.2 #7 & #8 will be dropped

New R/Markdown Tip(s)

  • Here is a good page on the logical operators available in R:
  • You can control the size of your images included in your file by putting a height argument at the end: ![](link to image.png){height="50%"}. Note the quotes.

09-06-2021 Week 3: Understanding probability through simulation

Schedule adjustment

Thank you all for extending grace while I was sick on Friday. Here are the schedule adjustments:

  • Group quiz 2 will be done Wed in class.
  • Ch 2.1 homework due by EOD Wednesday. You can do most of it already, but we will finish Ch 2.1 on Wednesday in class.
    • EOD means end of day, or midnight. On our schedule grid and google calendar, this will be displayed on the day it’s due. E.g. 9/8. However, Gradescope puts the date for midnight on the day after. So the deadline for Hw 2.1 in Gradescope looks like 9/9 at 12:00am.

Other updates/thoughts

  • Hw1 has been graded and entered into BBL. It’s your responsibility to check your score both in BBL and gradescope (to make sure they match).
  • After the individual quiz has been submitted and responses turned off, you are welcome to talk with each other on the answers.
  • You all are doing so very well helping each other out in Slack, and asking questions in the #clarifying-questions and the #general channels. Keep it up! And huge shout out to Sage for finding all my typos. If something isn’t clear, be sure to check Slack first!
  • I have recorded my solution to the “You Try It” problem on page 11 of the course notes. Dr. Gray’s version was already up, but I wanted to also use it to show off the two markdown tips I mention below.
    • This recording is now in the list of optional videos on the course schedule page.
    • Highly recommend watching this in 1.5x speed. The visual editor was being a bit finicky with copy/paste :/
  • HW 2.2 has been posted, but I don’t know what the due date will be yet. It will be a day or two after we finish with that section. I will try to release the problem sets earlier (thanks for the suggestion Jon)

New Markdown Tip(s)

  • Not digging writing markdown, or want to see what your file will look like without knitting? There is a visual editor available Rmarkdown. Follow the link to read more on how it can help you.
  • Since Markdown is a “lightweight” markup editor, you can’t do a lot of things with LaTeX that you could do in a full LaTeX (or Sweave) document, but you can use the \align{} environment to create aligned multi-line equations. For example:
P(A \cap B) & = P(A) + P(B) - P(A \cup B) \\
& = 1 - P(A^{c}) + 1 - P(B^{c}) - P(A \cup B) \\
& = [1 - P(A^{c})- P(B^{c})] + [1 - P(A \cup B)]


  • Use display math ($$)
  • Start the environment using \begin{align} and end the environment using \end{align}
  • Each line ends with two backslashes \\
  • Each line is aligned at the & symbol.

08-30-2021 Week 2: Introduction to Probability

Student Hours set:


  • Read Speegle Chapter 2.1 through Example 2.4
  • Download the Blank RMD file from the Notes column on the schedule. This is a blank copy of what you have in your course packet. Use this to run code as we discuss it in class.

New Markdown Tip

You can adding Images to your markdown file using the following code.

![](link to image.png)

This is not R code, so it does not go in a code chunk.

Example use: This week you’ll be hand drawing some venn diagrams. To add these images to your homework do the following:

  1. Generate the image by either
    • Draw on pencil and paper, then snap a pic with your phone & transfer it to your computer.
    • Use a drawing app on your computer to draw a picture, then take a screenshot of your artistry.
  2. Put that image in the same folder as your homework. Let’s call it venn1.png
  3. Add it to your homework submission using the following code: ![](venn1.png)

08-23-2021 Week 1: Welcome to Fall 21!

This is an orientation & onboarding week. The goal is to get you up and running with R, R Studio and the rest of our course tools. This course website contains all materials except the textbook and course packet for this class.

COVID-19 protocol

We all want this semester to be fully in person for the whole semester and so it is YOUR responsibility to help make that a reality. To do that

  • Get vaccinated if you are able to.
  • Wear a mask (including over your nose) the entire time you are in class.
  • If you are not feeling well DO NOT COME TO CLASS. Ping me on Slack to let me know and we’ll figure out a plan.
  • Read the syllabus to fully understand campus policy.