Question: Create a function that will take in a vector x, with corresponding probabilities p.x, assuming that these two vectors correspond to a discrete random variable.

Create a function that will take in a vector x, with corresponding probabilities p.x, assuming that these two vectors correspond to a discrete random variable. Using the formulas for the mean and variance for a discrete random variable, have the function return the mean and variance of the following:

(a) x = c(0,1,2,5,6,10) p.x = c(0.50,0.05,0.10,0.05,0.05,0.15)

(b) x = seq(-20,0,2) p.x = (1:11)/sum(1:11)

(c) x = 0:5 p.x = dbinom(0:5,5,0.50)

This should be done in the programming language R so please be sure to include all of your code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!