Question
This is a discrete distribution, with two parameters q and (where 0 q 1, > 0). If a random variable X
This is a discrete distribution, with two parameters q and À (where 0 ≤ q ≤ 1, λ > 0). If a random variable X has a ZIP(q, X) distribution, then its probability mass function px is given by: px (0) Pr[X=0] =q+(1-q)e-λ = A ke-1 k! px (k) = Pr[X = k] = (1 — q) - for k= 1, 2, 3, . . . So, like the "regular" Poisson, X has the natural numbers N = {0, 1, 2, 3, ...} as possible outcomes.
1. Create a function called dZIP, which satisfies the following:
• It has three arguments: one called k (with no default value), one called q (with the default value set to 0), and one called lambda (with the default value set to 1).
• It returns the probability mass function px (k) of a ZIP random variable (with parameters q and lambda), and is evaluated at k.
2. Create a function called pZIP, which satisfies the following:
• It has the same three arguments (and default values) as the previous function dZIP.
• It returns the CDF (cumulative distribution function) Fx (k) of a ZIP random variable (with parameters q and lambda), and is evaluated at k.
Hint: You can call a function (e.g. dZIP) within another function. But be careful that if you do this, all arguments of the inner function (e.g. dZIP) must be correctly specified (and even if their names are the same as those of the outer function, e.g. pZIP).
3. Using the functions you created before (or otherwise), compute the expected value E[X] for X ~ ZIP(q = 1/π, λ = √√2) and place the result in a variable called E.X
4. Create a function called qZIP, which satisfies the following:
• It has the same three arguments (and default values) as the previous two functions dZIP, pZIP. • It returns the quantile function Q(k) of a ZIP random variable (with parameters q and lambda and evaluated at k) where the quantile function Q(k) is defined as follows: Q(k) = min{x € N:k ≤ Fx (x)}.
That is to say: Q(k) returns the smallest integer x such that the CDF evaluated at x is equal to or exceeds k. [You can assume that the argument k passed to the function satisfies: 0 < k < 1] Hint: Same as before, you can call a function (e.g. pZIP) within another function.
Step by Step Solution
3.39 Rating (161 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started