Displaying 1 result from an estimated 1 matches for "bootstrapsample".
2017 Dec 07
1
Seeking help with code
...(26.64, 30.65, 31.27, 33.04, 32.56, 29.10, 28.96, 26.44, 27.76, 32.27)
#calculate mean of the sample for days of rain
mdr=mean(drain)
mdr
#calculate the parameter of the exponential distribution
lambdahat = 1.0/mdr
lambdahat
#draw the bootstrap sample from Exponential
x = rexp(n*b, lambdahat)
x
bootstrapsample = matrix(x, nrow=n, ncol=b)
bootstrapsample
# Compute the bootstrap lambdastar
lambdastar = 1.0/colMeans(bootstrapsample)
lambdastar
# Compute the differences
deltastar = lambdastar - lambdahat
deltastar
# Find the 0.05 and 0.95 quantile for deltastar
d = quantile(deltastar, c(0.05,0.95))
d
# C...