# Compute Sample Means Econometrics Questions

Description

2 attachmentsSlide 1 of 2attachment_1attachment_1attachment_2attachment_2.slider-slide > img { width: 100%; display: block; }
.slider-slide > img:focus { margin: auto; }

Unformatted Attachment Preview

ECON 3P90  Econometrics
Practical Lab #2
Probability
January 24  January 28, 2022
Probability Distributions of Discrete Random Variables
A typical example of a discrete random variable D is the result of a dice roll. In terms of a
random experiment, this is nothing but randomly selecting a sample of size 1 from a set of
numbers which are mutually exclusive outcomes. Here, the sample space is {1,2,3,4,5,6}.
A basic function in R to draw random samples from a specified set of elements
is the function sample(). Type ?sample in R Console for detailed information on that
function. We can use it to simulate the random outcome of a dice roll. Lets roll the dice!
sample(1:6, 1)
##  6
The sample function above asks the R algorithm to draw at random 1 element from the
sequence 1 to 6, where all numbers have the same probability of being selected, here 1/6. The
probability distribution function (PDF) of a discrete random variable is the list of all possible
values of the variable and their probabilities, which sum to 1. The cumulative probability
distribution function (CDF) gives the probability that the random variable is less than or equal
to a particular value.
For the dice roll, the probability distribution and the cumulative probability distribution are
summarized in the following Table:
Figure 1: PDF and CDF of a Dice Roll
We can easily plot both functions using R. Since the probability equals 1/6 for each outcome,
we set up the vector probability by using the function rep(), which replicates a given
value a specified number of times.
# generate the vector of probabilities
probability