Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 R to evaluate (approximate) the expectation of binomial distributed random variables having the following probability mass function.
P(x=k)=([n],[k])pk(1-p)n-k for k=0,1,2,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 n=10,20 and 30 with p=0.25 and 0.6 respectively. Your code should loop through the values of n and p, and for each combination of n and p, it should loop through each value of x in the definition of the expected value. Store your values in a matrix called expected. Do NOT use the built-in function dbinom() for this question.
b) Based on the R code in part (a), create an R function called BinExp that can return the approximated expectation of a binomial distributed random variable with any given n>1 and pin(0,1).
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago