Question

Suppose X1, X2, . . . , X21 are i.i.d. Poisson random variables with rate parameter...

Suppose X1, X2, . . . , X21 are i.i.d. Poisson random variables with rate parameter λ = 1/2. Estimate, using simulation, the probability that the sample mean is larger than the sample median.

How do you do this using R?

Homework Answers

Answer #2

The R code is pasted below.

# DECLARING SAMPLE SIZE AND RATE PARAMETER
n = 21
lambda = 0.5

# DECLARING TWO VECTORS TO STORE SAMPLE MEANS AND SAMPLE MEDIANS FOR 1000 SIMULATIONS
sample_mean=NULL
sample_median=NULL

# 1000 SIMULATIONS
for(i in 1:1000)
{
sample_mean[i]=mean(rpois(n,lambda))
sample_median[i]=median(rpois(n,lambda))
}
prob = ifelse(sample_mean > sample_median,1,0)

# THE PROBABILITY THAT THE SAMPLE MEAN IS GREATER THAN THE SAMPLE MEDIAN
# (ESTIMATED PROBABILITY)
sum(prob)/1000

answered by: anonymous
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Let X1, X2,... be a sequence of independent random variables distributed exponentially with mean 1. Suppose...
Let X1, X2,... be a sequence of independent random variables distributed exponentially with mean 1. Suppose that N is a random variable, independent of the Xi-s, that has a Poisson distribution with mean λ > 0. What is the expected value of X1 + X2 +···+ XN2? (A) N2 (B) λ + λ2 (C) λ2 (D) 1/λ2
Please show your steps for the question below(include R codes if possible): Let X1, X2, ...,...
Please show your steps for the question below(include R codes if possible): Let X1, X2, ..., X30 be i.i.d Poisson random variables with a mean of 5. Find the probability that the sample mean X is between 4 and 6.
Let X1 and X2 be independent Poisson random variables with respective parameters λ1 and λ2. Find...
Let X1 and X2 be independent Poisson random variables with respective parameters λ1 and λ2. Find the conditional probability mass function P(X1 = k | X1 + X2 = n).
Let X and Y be independent random variables following Poisson distributions, each with parameter λ =...
Let X and Y be independent random variables following Poisson distributions, each with parameter λ = 1. Show that the distribution of Z = X + Y is Poisson with parameter λ = 2. using convolution formula
Suppose that X1 and X2 are independent standard normal random variables. Show that Z = X1...
Suppose that X1 and X2 are independent standard normal random variables. Show that Z = X1 + X2 is a normal random variable with mean 0 and variance 2.
You are given that X1 and X2 are two independent and identically distributed random variables with...
You are given that X1 and X2 are two independent and identically distributed random variables with a Poisson distribution with mean 2. Let Y = max{X1, X2}. Find P(Y = 1).
Suppose X1 and X2 are independent expon(λ) random variables. Let Y = min(X1, X2) and Z...
Suppose X1 and X2 are independent expon(λ) random variables. Let Y = min(X1, X2) and Z = max(X1, X2). (a) Show that Y ∼ expon(2λ) (b) Find E(Y ) and E(Z). (c) Find the conditional density fZ|Y (z|y). (d) FindP(Z>2Y).
Let X1, X2, X3 be a random sample of size 3 from a distribution that is...
Let X1, X2, X3 be a random sample of size 3 from a distribution that is Normal with mean 9 and variance 4. (a) Determine the probability that the maximum of X1; X2; X3 exceeds 12. (b) Determine the probability that the median of X1; X2; X3 less than 10. (c) Determine the probability that the sample mean of X1; X2; X3 less than 10. (Use R or other software to find the probability.)
Let X1, X2 be two normal random variables each with population mean µ and population variance...
Let X1, X2 be two normal random variables each with population mean µ and population variance σ2. Let σ12 denote the covariance between X1 and X2 and let ¯ X denote the sample mean of X1 and X2. (a) List the condition that needs to be satisfied in order for ¯ X to be an unbiased estimate of µ. (b) [3] As carefully as you can, without skipping steps, show that both X1 and ¯ X are unbiased estimators of...
Suppose X1, X2, X3, and X4 are independent and identically distributed random variables with mean 10...
Suppose X1, X2, X3, and X4 are independent and identically distributed random variables with mean 10 and variance 16. in addition, Suppose that Y1, Y2, Y3, Y4, and Y5are independent and identically distributed random variables with mean 15 and variance 25. Suppose further that X1, X2, X3, and X4 and Y1, Y2, Y3, Y4, and Y5are independent. Find Cov[bar{X} + bar{Y} + 10, 2bar{X} - bar{Y}], where bar{X} is the sample mean of X1, X2, X3, and X4 and bar{Y}...