Question

In: Statistics and Probability

1. (a) Simulate a random sample of size 100 from the exponential distribution with the rate...

1. (a) Simulate a random sample of size 100 from the exponential distribution with the rate parameter λ = 10. Then make a histogram of the simulated data.

(b) We use the simulated data as a data set to construct the log-likelihood function as an R function. We will find the MEL of the value λ = 10. Choose the appropriate range for the parameter λ, then make a plot of the log-likelihood function.

(c) Use R function ‘optim‘ to find the MLE λˆ and its SE SE(λˆ). Then construct the 95% confidence interval of λ. Does the confidence interval include the true value λ = 10?

Solutions

Expert Solution

(a).

(b).

.

(c).

MLE of = 8.8735 and Standarad Error = 0.0113

95% confidence interval = (8.3977, 12.4922)

According to computed Interval we can say that this interval contains the true value of parameter.

R code:

##### Program to find MLE of lamda ##############
n =100
x = rexp(n, 0.1)
hist(x, main = "Histogram of generated samples", col = "brown")
lamda = seq(1:10)
l_log = (n*log(lamda))-(lamda*sum(x))
plot(lamda, l_log, type = "l", col = "brown", main = "lamda Vs Loglikelihood")

l_L = function(lamda){
-(n*log(lamda))+(lamda*sum(x))
}
mle = optim(1, l_L, )
mle
l = mean(x)-(1.96*(sqrt(mean(x)^2)/n));l
u = mean(x)+(1.96*(sqrt(mean(x)^2)/n));u
Output:

> ##### Program to find MLE of lamda ##############
> n =100
> x = rexp(n, 0.1)
> hist(x, main = "Histogram of generated samples", col = "brown")
> lamda = seq(1:10)
> l_log = (n*log(lamda))-(lamda*sum(x))
> plot(lamda, l_log, type = "l", col = "brown", main = "lamda Vs Loglikelihood")
>
> l_L = function(lamda){
+ -(n*log(lamda))+(lamda*sum(x))
+ }
> mle = optim(1, l_L )

$par
[1] 0.1126953

$value
[1] 318.2901

$counts
function gradient
36 NA

$convergence
[1] 0

$message
NULL
> l = mean(x)-(1.96*(sqrt(mean(x)^2)/n));l
[1]  8.397744
> u = mean(x)+(1.96*(sqrt(mean(x)^2)/n));u
[1] 12.49217


Related Solutions

A random sample of size 30 from an exponential distribution with mean 5 is simulated. Show...
A random sample of size 30 from an exponential distribution with mean 5 is simulated. Show the R-code to plot the empirical cdf for this sample along with the true cdf in the sample graph.
A random sample of size 30 from an exponential distribution with mean 5 is simulated. Describe...
A random sample of size 30 from an exponential distribution with mean 5 is simulated. Describe the process of plotting the empirical cdf for this sample along with the true cdf in the sample graph.
For a random sample of sizenfrom an Exponential distribution with rate parameter λ (so that the...
For a random sample of sizenfrom an Exponential distribution with rate parameter λ (so that the density is fY(y) =λe−λy), derive the maximum likelihood estimator, the methods of moments estimator, and the Bayes estimator (that is, the posterior mean) using a prior proportional to λe−λ, for λ >0. (Hint: the posterior distribution will be a Gamma.)
e. Suppose a random sample of size 100 is taken from a distribution with mean 200...
e. Suppose a random sample of size 100 is taken from a distribution with mean 200 and variance 400. What is the distribution of the sample mean ?%? (State the name and parameter(s) of the distribution) f. For a medical test, the probability of testing positive for a healthy person is 5%. Based on this, can we find the probability of testing positive for an infected person? If yes, explain how; if no, explain why.
Let X1, ..., Xn be a random sample of size n from an exponential ditribution with...
Let X1, ..., Xn be a random sample of size n from an exponential ditribution with parameter lambda . Let Di=(n-i+1)[X(i)-X(i-1)] i=1,.... n , where X(0)=0 be the normalized spacings. Using Jacobians, derive the joint distribution of D1,....., Dn.
A random sample of size n = 100 is taken from a population of size N...
A random sample of size n = 100 is taken from a population of size N = 600 with a population proportion of p =0.46. Is it necessary to apply the finite population correction factor? Calculate the expected value and standard error of the sample proportion. What is the probability that the sample mean is less than .40?
7) Use Excel to generate a series of 100 random values from the exponential distribution with...
7) Use Excel to generate a series of 100 random values from the exponential distribution with a mean of 25? USING EXCEL SHOW ALL WORK
Consider a random sample of size n from a distribution with function F (X) = 1-...
Consider a random sample of size n from a distribution with function F (X) = 1- x-2 if x > 1 and zero elsewhere. Determine if each of the following sequences has distribution limit; if so, give the limit distribution. a)x1:n b)xn:n c)n-1/2 xn:n
Let Y1, Y2, ..., Yn be a random sample from an exponential distribution with mean theta....
Let Y1, Y2, ..., Yn be a random sample from an exponential distribution with mean theta. We would like to test H0: theta = 3 against Ha: theta = 5 based on this random sample. (a) Find the form of the most powerful rejection region. (b) Suppose n = 12. Find the MP rejection region of level 0.1. (c) Is the rejection region in (b) the uniformly most powerful rejection region of level 0.1 for testing H0: theta = 3...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT