Question: Create function that will take in a vector x, with corresponding probabilities p.x, assuming that these two vectors correspond to a discrete random variable. Have
Create function that will take in a vector x, with corresponding probabilities p.x, assuming that these two vectors correspond to a discrete random variable. Have this function return the mean of the two vectors, and the variance of the two vectors. Use your function to find the mean and standard deviation of the following vectors:
(a) x = c(0,1,2,5,6,10) p.x = c(0.10,0.05,0.50,0.10,0.10,0.05)
(b) x = seq(-10,10,2) p.x = (1:11)/sum(1:11)
(c) x = seq(100,1090,10) p.x = seq(100:1)/sum(1:100)
(d) x = 0:5 p.x = dbinom(0:5,5,0.50)
R coding
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
