Question

In: Statistics and Probability

Obtain results for standard error of the mean, confidence intervals and CLT convergence for random samples...

Obtain results for standard error of the mean, confidence intervals and CLT convergence for random samples drawn from exponential distribution.

Sample Size: 1,2,4,8,16,32,64,128

a. Produce plot of standard error of the mean for exponential distribution (using rexp). Remember that population variance for exponential distribution with rate λ is 1/ λ^2

b. Demonstrate the calculation of confidence interval for a mean of a random sample drawn from exponential distribution – both using confint and mean, sd, qt – make sure the two approaches produce the same answer.

c. Generate plots illustrating CLT convergence to normality for the sum of i.i.d. variables distributed according to the exponential distribution (do not fall into a trap: in contrast to Bernoulli distribution, we do not have a ready-to-use analytical expression for a sum of n exponential random variables, so you will have to sample explicitly and sum up the samples drawn).

Solutions

Expert Solution

(a) R CODE TO PRODUCE PLOT OF STANDARD ERROR OF MEAN OF EXPONENTIAL DISTRIBUTION USING "rexp":

SIMULATION:

   means<-vector("numeric")

   variance<-vector("numeric")

   Std.error<-sqrt(variance)

   for (i in 1:nsimulations)    #nsimulations- number of simulations you prefer

   {

   sample=rexp(sample size,rate=lambda)   

means=c(means,mean(sample))

variances=c(variances,variance(sample))

Std_error=c(Std_error,sqrt((variances)/n^2))

}

CODE FOR PLOT OF STANDARD ERROR:

hist(Std_error, break=50, main="Histogram of standard error", xlab="standard error of sample")

abline(v=Std.error.theory,lwd=3,col="red")    #Stderror.theory is theoretical standard error

  abline(v=mean(Std.error),lwd=3,col="blue",lty=2)

legend("topright", c("Theoretical Standard Error","Average Standard error"), bty="n", lwd=3,

col=c("red","blue"), lty=c(1,2))

(b) CONFIDENCE INTERVAL:

USING sd:

simdata=rexp(sample size, rate=lamda)

matrixdata=matrix(simdata,nrow=,ncol=)

means.exp=apply(matrixdata,1,mean)

Mean=mean(means.exp)

se=sd(mean.exp)/sqrt(n)

lower=mean(means.exp) - (1.96*se)

upper=mean(means.exp) + (1.96*se)

c(lower,upper)

USING qt:

means=c()

for (i in 1:nevents)    #nevents- no of sample means

{

m=mean(rexp(sample size, rate=lamba))

means=append(means,m)

}

center=mean(means)

sdev=sd(means)

error=qt(0.975, df=length(means)-1)*sdev/sqrt(length(means)

lower=center-error

upper=center+error

CI=c(lower,upper)

(c) GENERATING PLOTS ILLUSTRATING CENTRAL LIMIT THEOREM (CLT):

CLT states that when certain conditions are satisfied, sample means are approximately normally distributed, nomatter what the underlying distribution is.

set.seed(1234)

X=rexp(1000,rate=lambda) # 1000 is number of sample means

hist(X, probability=TRUE, main="Figure 1-1000 Exponential distribution with rate(lambda)",col="grey", xlab="sample means",breaks=100)

#CODE FOR GENERATING DISTRIBUTION OF SAMPLE MEANS

set.seed(112)

mns=NULL

for ( i in 1:1000)

{

mns=c(mns, mean(rexp(sample size, lambda))

hist(mns,probability=TRUE, main="Figure 2-1000 sample means of exponential sample size=preferred samplesize", xlab="Means of sample means", breaks=100, col="grey")

abline(v=mean(mns),col="blue",lty=2,lwd=4)

abline(v=population mean,col="red",lty=2,lwd=3)

lines(density(mns), lwd=3, col="black")

text(3.8,0.45, pos=3.8, "Red line is the \n location of \n the theoretical mean",cex=0.8,col="red")

text(5.5,0.58, pos=4, "Blue line is the \n location of \n the calculated mean",cex=0.8,col="blue")

#CODE FOR TEST OF NORMALITY

qqnorm(mns,main="Figure 3-Normal Q-Q plot, sample size n= ");

qqline(mns,col=2)

For random sample of size n, the following three corollaries hold:

  1. CLT states that the distribution of averages of iid variables becomes that of a standard normal distribution as the sample size increases.Normal probability plot determines if the sample is drawn from normal distribution.
  2. mean of sample means and population means are equal.
  3. Population standard deviation and standard deviation of sample means are related by formula,

#CODE FOR CALCULATING MEAN AND VARIANCE OF SAMPLE MEAN:

X_n=mean(mns) #Sample mean

v=var(mns) #Sample variance


Related Solutions

Find the mean, standard deviation, 80%, 95%, and 99% confidence intervals, and margin of error for...
Find the mean, standard deviation, 80%, 95%, and 99% confidence intervals, and margin of error for those intervals. Show all work. $32,096 $29,716 $29,227 $27,209 $22,794 $19,306 $19,238 $19,164 18,994 $18,329 $17,978 $17,626 $16,823 $16,709 $15,967 $15,921 $15,908 $15,905 $15,638 $15,629 $14,414 $14,229 $14,137 $14,051 $13,907 $13,776 $13,281 $12,739 $12,300 $11,994 $11,262 $11,112 $10,984 $10,824 $10,823 $10,448 $10,081 $9,883 $9,668 $9,663 $9,337 $8,855 $8,741 $8,596 $8,385 $7,204 $7,072 $6,503 $5,653 $4,602
Calculate the Mean, Median, Standard Deviation, Coefficient of Variation and 95% population mean confidence intervals for...
Calculate the Mean, Median, Standard Deviation, Coefficient of Variation and 95% population mean confidence intervals for property prices of Houses based on the following grouping:  Proximity of the property to CBD Note: Calculate above statistics for both “Up to 5KM” and “Between 5KM and 10KM”  Number of bedrooms Note: Calculate above statistics for “One bedroom”, “Two bedrooms” and “Three bedrooms or more”  Number of bathrooms Note: Calculate above statistics for “One bathroom”, “Two bathrooms”, “Three bathrooms or...
Which of the following samples would have the lowest standard error of the mean? n =...
Which of the following samples would have the lowest standard error of the mean? n = 9 from a population with σ = 60. n = 9 from a population with σ = 100. n = 49 from a population with σ = 60. n= 49 from a population with σ = 100.
Confidence Intervals (Proportions) 1 Find the margin of error and 95% confidence interval for the following...
Confidence Intervals (Proportions) 1 Find the margin of error and 95% confidence interval for the following surveys. Round all answers to 2 decimal places. (a) A survey of 500 people finds that 56% plan to vote for Smith for governor. Margin of Error (as a percentage): Confidence Interval: % to % (b) A survey of 1500 people finds that 47% support stricter penalties for child abuse. Margin of Error (as a percentage): Confidence Interval: % to % 2 Assume that...
mean 94.6129 n= 31 standard deviation is 45.0612 find the 95% and 99% confidence intervals of...
mean 94.6129 n= 31 standard deviation is 45.0612 find the 95% and 99% confidence intervals of the standard devaition find the 95% and 99% confidence interval for population mean data set 10 19 35 39 41 56 67 67 69 73 75 78 81 82 83 83 84 91 92 94 123 125 137 138 140 142 150 152 161 163 183
Find the point estimate, the standard error, and the margin of error for the given confidence...
Find the point estimate, the standard error, and the margin of error for the given confidence level and values of x and n. x=45, n=97, confidence level 95% (a) Find the point estimate. (b) Find the standard error. (c) Find the margin of error.
Find the 80%, 95%, and 99% confidence intervals & margin error Create your own confidence interval...
Find the 80%, 95%, and 99% confidence intervals & margin error Create your own confidence interval (you cannot use 80%, 95%, and 99%) and make sure to show your work. Make sure to list the margin of error. 122 132 97 102 106 116 94 132 112 123 123 108 84 120 125 123 115 103 127 139 122 124 112 113 109 104 120 109 117 108 125 109 119 138 125 104 110 101 130 124 115 104...
Compute 95% bootstrap confidence intervals for the mean time between failures 1/λ by the standard normal,...
Compute 95% bootstrap confidence intervals for the mean time between failures 1/λ by the standard normal, basic, percentile, and BCa methods. Compare the intervals and explain why they may differ. 3, 5, 7, 18, 43, 85, 91, 98, 100, 130, 230, 487. Use R software and provide with codes
What are the confidence intervals for a population mean? Provide examples.
Question 2 What are the confidence intervals for a population mean? Provide examples. Question 3 A confidence interval for the population mean when the population follows the normal distribution and the population standard deviation is known is computed by? Provide examples.
Confidence Intervals for a proportion and mean Do all steps in the confidence interval: a) Check...
Confidence Intervals for a proportion and mean Do all steps in the confidence interval: a) Check when easy the requirements for the interval (t-interval) b) Create a summary of the information that goes into the interval c) Write out the formula for the interval d) Replace the symbols in the formula with the numbers from (b) e) Produce the interval f) Interpret the interval In 1998, as an advertising campaign, the Nabisco Company announced a "1000 Chips Challenge," claiming that...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT