Question: a ) Using loop in R to evaluate ( approximate ) the expectation of binomial distributed random variables having the following probability mass function. P
a Using loop in to evaluate approximate the expectation of binomial distributed random variables having the following probability mass function.
for cdotsn
Compute the expectation using the definition of the expectation of a discrete random variable, not a short cut formula for a binomial random variable. In your approximation, consider and with and respectively. Your code should loop through the values of and and for each combination of and it should loop through each value of in the definition of the expected value. Store your values in a matrix called expected. Do NOT use the builtin function dbinom for this question.
b Based on the code in part a create an function called BinExp that can return the approximated expectation of a binomial distributed random variable with any given and pin
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
