Question

In: Statistics and Probability

What is the code in Rstudio or R? (a) Generate 200 random samples of size n...

What is the code in Rstudio or R?

(a) Generate 200 random samples of size n = 10 from a Poisson distribution with mean λ = 12.

i. Calculate sample means for each sample. Report the first 10 sample means.

ii. Draw a histogram of the sample means (where the y-axis is the density) and fit a density estimate (default density estimator is ok).

iii. What is your finding about the sampling distribution of the sample mean, based on your histogram. Be sure to give the distribution name along with its parameter estimates.

(b) Generate 200 random samples of size n = 50 from a Poisson distribution with mean λ = 12.

i. What distribution is the new set of sample means? State the exact distribution expected from theory (including parameter values), and state the distribution obtained from your samples (including estimated parameter values).

ii. Based on this distribution, construct a 95% confidence interval for the mean λ. Assume σ is known.

(c) Generate 200 random samples of size n = 20 from a Chi-Square distribution with degrees of freedom df = 6.

i. Find the first quantile Q1 from each sample (note: qchisq() gives the quantile from the exact distribution, NOT the sample). Report the first 10 quantiles.

ii. Draw a histogram of the sample Q1’s (where the y-axis is the density) and fit a density estimate (default density estimator is ok).

(d) Generate 200 random samples of size n = 100 from a Chi-Square distribution with degrees of freedom df = 6.

i. Draw a histogram of the sample first quantiles (where the y-axis is the density) and fit a density estimate (default density estimator is ok).

ii. Are there any differences between the distribution from Problem 2(a)ii and 2(b)i? Describe any differences you may see.

Solutions

Expert Solution


Related Solutions

r programming generate 100 samples of size n= 5 from a normal random variable with u=2,...
r programming generate 100 samples of size n= 5 from a normal random variable with u=2, o= 3 in r
Use R to generate n = 400 samples (idependent identically distributed random numbers) of X ∼...
Use R to generate n = 400 samples (idependent identically distributed random numbers) of X ∼ N(0, 4). For each Xi , simulate Yi according to Yi = 3 + 2.5Xi + εi , where εi ∼ N(0, 16), i = 1, ..., n. Use R to solve the following questions. (a) Compute the least square estimators of βˆ 0 and βˆ 1. (b) Draw a regression line according to the numbers computed in (a). Plot Y and X with...
Write the R code to generate five independent uniform random numbers and use that to generate...
Write the R code to generate five independent uniform random numbers and use that to generate 5 independent Bernoulli random variables with probability of success p = 0.4. please use RStudio. please do not use lab nor rbern for calculations.
Suppose a simple random sample of size n=200 is obtained from a population whose size is...
Suppose a simple random sample of size n=200 is obtained from a population whose size is Upper N= 20,000 and whose population proportion with a specified characteristic is p equals 0.6 .p=0.6. Complete parts ​(a) through​ (c) below. (a) Determine the standard deviation (b) What is the probability of obtaining x=124 or more individuals with the​ characteristic? That​ is, what is ​P(p≥0.62)? (c) What is the probability of obtaining x=106 or fewer individuals with the​ characteristic? That​ is, what is...
in R. Generate a random sample of size 700 from a gamma distribution with shape parameter...
in R. Generate a random sample of size 700 from a gamma distribution with shape parameter 8 and scale parameter 0.1. Create a histogram of the sample data. Draw the true parametric density (for the specified gamma distribution) on the histogram. The curve for the density should be red. (Note: The “true parametric density” is the distribution from which the sample values were generated. It is NOT the kernel density that is estimated from the data.)
R Simulation: For n = 1000, simulate a random sample of size n from N(0,1). Use...
R Simulation: For n = 1000, simulate a random sample of size n from N(0,1). Use the generated data to give an approximation to the critical values when α = 0.01,0.05,0.1, and compare them with the theoretical values zα/2. Repeat with n = 10,000 to get a better approximation. Please use Commands quantile( ) or qnorm( ) or both.
Generate 100 samples of size n=8 from an exponential distribution with mean 3 . Each row...
Generate 100 samples of size n=8 from an exponential distribution with mean 3 . Each row of your data will denote an observed random sample of size 8, from an exponential distribution with mean 3. Obtain sample mean for each sample, store in another column and make a histogram for sample means. Repeat for n=100. Compare and interpret the histograms you obtained for n=8 and n=100. Submit the histograms along with your one small paragraph comparison. Can you solve it...
Write a code in R markdown Independent random samples of companies in the three countries yielded...
Write a code in R markdown Independent random samples of companies in the three countries yielded the following data on financial losses (in trillion dollars). A B C 13 17 11 10 12 7 13 18 9 14 13 13 15 15 24 (1) Simulate and plot the null distribution of the ANOVA test statistic, including a vertical line corresponding to the observed test statistic value. (2) Calculate the P-value (3) Is there a significant difference in the mean profit...
Write a code in R markdown Independent random samples of companies in the three countries yielded...
Write a code in R markdown Independent random samples of companies in the three countries yielded the following data on financial losses (in trillion dollars). A B C 13 17 11 10 12 7 13 18 9 14 13 13 15 15 24 (1) Simulate and plot the null distribution of the ANOVA test statistic, including a vertical line corresponding to the observed test statistic value. (2) Calculate the P-value (3) Is there a significant difference in the mean profit...
7. Use the population of {1, 3, 7}. Assume that the random samples of size n...
7. Use the population of {1, 3, 7}. Assume that the random samples of size n = 2 Construct a sampling distribution of the sample mean. After identifying the 9 different possible samples (with replacement), find the mean of each sample, then construct a table representing the sample the sampling distribution of the sample mean. In the table, combine values of the sample mean that are the same. (Hint: condense the table similar to examples presented in class.) a. Sample...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT