Question

Use R. Generate a random sample with n=15 random observations from an exponential distribution with mean=1....

Use R.

Generate a random sample with n=15 random observations from an exponential distribution with mean=1.

  • Calculate the sample median, which is an estimator of the population median.
  • Use bootstrap (nonparametric, with B=1000) methods to estimate the variance of the estimator for the population median.
  • use the Monte Carlo method, e.g. generate 1000 samples of size 15 to estimate the true variance of the median estimator. Compare and comment on your results.

Homework Answers

Answer #1

> n=15
> b=1000
> s=rexp(n,1);s #sample of size n=15 from exponential with mean=1
[1] 0.407867708 0.223045019 0.571697697 0.516058067 1.433474415 0.005044012 0.292488087
[8] 1.265140870 0.561035751 2.060778400 1.044908378 0.274859678 0.376427082 0.130451812
[15] 0.048147370
> sample_median=median(s);sample_median
[1] 0.4078677
> #bootsrap
> med=c()
> for(i in 1:b)
+ {
+ s=sample(s,n)
+ med[i]=median(s)
+ }
> var(med) #bootsrap estimate of variance of estimate of population median
[1] 0
>
> ##monte carlo
> med1=c()
> for(i in 1:1000)
+ {
+ s=rexp(15,1)
+ med1[i]=median(s)
+ }
> var(med1)
[1] 0.06725635

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
Use R statistical software to answer the following: Let X1, ..., X6 be a random sample...
Use R statistical software to answer the following: Let X1, ..., X6 be a random sample of size n = 6 from the distribution with pdf f(x) = x / 8 , 0 < x < 4 and 0 otherwise. (a) Use Monte Carlo to calculate Var(Xbar), and knowing that Var(Xbar) = sigma^2 / n, what is the true value of Var(Xbar)? ## use runif() to generate samples
a. If ? ̅1 is the mean of a random sample of size n from a...
a. If ? ̅1 is the mean of a random sample of size n from a normal population with mean ? and variance ?1 2 and ? ̅2 is the mean of a random sample of size n from a normal population with mean ? and variance ?2 2, and the two samples are independent, show that ?? ̅1 + (1 − ?)? ̅2 where 0 ≤ ? ≤ 1 is an unbiased estimator of ?. b. Find the value...
use R software Suppose that X1, …, Xn are a random sample from a lognormal distribution....
use R software Suppose that X1, …, Xn are a random sample from a lognormal distribution. Construct a 95% confidence interval for the parameter μ. Use a Monte Carlo method to obtain an empirical estimate of the confidence level when data is generated from standard lognormal.
Use R to code a function to generate a random sample of size n from the...
Use R to code a function to generate a random sample of size n from the Beta(a, b) distribution by the acceptance-rejection method. (1) Generate a random sample of size 3000 from the Beta(4,3) distribution. (2) Graph the histogram of the sample with the theoretical Beta(4,3) density superimposed. Answer the above questions by showing the R codes and results.
Randomly generate 100 numbers in Excel. These numbers are supposed to be from a normal distribution...
Randomly generate 100 numbers in Excel. These numbers are supposed to be from a normal distribution with mean equal to 1 and standard deviation equal to 5. Use Excel to do the Normality Check. Compare the estimated mean and standard deviation to the actual value (i.e., 1 and 5). Use Monte Carlo Analysis in Excel to estimate the value of π. Choose N= 100, 1000, and 10000 and compare the results.
i.Bias of Sample Mean Draw 20 samples from the normal distribution N(5, 4). Compute the mean...
i.Bias of Sample Mean Draw 20 samples from the normal distribution N(5, 4). Compute the mean of your 20 samples. Report the bias of the sample mean ii. Variance of Sample Mean (Continue of problem i) To estimate the variance of the sample mean, we need to draw many different samples of size 20. Now, we draw 1000 times a sample of size 20. Store all the 1000 sample means. Report the variance of the estimated sample mean. Hint: To...
2) Airline accidents: According to the U.S. National Transportation Safety Board, the number of airline accidents...
2) Airline accidents: According to the U.S. National Transportation Safety Board, the number of airline accidents by year from 1983 to 2006 were 23, 16, 21, 24, 34, 30, 28, 24, 26, 18, 23, 23, 36, 37, 49, 50, 51, 56, 46, 41, 54, 30, 40, and 31. a. For the sample data, compute the mean and its standard error (from the standard deviation), and the median. b. Using R, compute bootstrap estimates of the mean, median and 25% trimmed...
How to do the following in R: Write a function to generate a random sample of...
How to do the following in R: Write a function to generate a random sample of size n from the Gamma(α,1) distribution by the acceptance-rejection method. Generate a random sample of size 1000 from the Gamma(3,1) distribution. (Hint: you may use g(x) ∼ Exp(λ = 1/α) as your proposal distribution, where λ is the rate parameter. Figure out the appropriate constant c).
How to do the following in R: Write a function to generate a random sample of...
How to do the following in R: Write a function to generate a random sample of size n from the Gamma(α,1) distribution by the acceptance-rejection method. Generate a random sample of size 1000 from the Gamma(3,1) distribution. (Hint: you may use g(x) ∼ Exp(λ = 1/α) as your proposal distribution, where λ is the rate parameter. Figure out the appropriate constant c).
Use R and the RANDBETWEEN(1,300) function to generate: a) 100 random numbers, b) 100 samples of...
Use R and the RANDBETWEEN(1,300) function to generate: a) 100 random numbers, b) 100 samples of size 5, and c) 100 samples of size 20. For each sample in parts (b) and (c), find the sample means. Create histograms for parts (a), (b) and (c). For part (a) use the random numbers (i.e. sample size 1), for parts (b) and (c) use the sample means to create the histograms. Copy and Paste just the histograms into your homework paper. Explain...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT