Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose we need to determine the lifespan parameter of a different electrical co

ID: 3268223 • Letter: S

Question

Suppose we need to determine the lifespan parameter of a different electrical component using the lifetimes of a sample of 100 components. Run the following R code to obtain a random sample of 100 values drawn from an exponential distribution with unknown parameter lambda. (You don't need to provide the values.) lifespans = rexp(100,runif(1,0.01,0.02)) (a) Calculate the sample average, variance, and standard deviation. If you use R. also provide the code you use. (b) Find a 95% confidence interval for the population mean. If you use R. provide your code. (c) Suppose your friend claims to have "psychic powers", and "divines" that the true mean of the population you just sampled from is 66.7. Test your friend s claim with alpha = 0.05 significance. i. What Is the null hypothesis? (Use words or mathematical notation.) ii. What Ls your alternative hypothesis? (Use words or mathematical notation.) iii. Which distribution should you use for your test? iv. What is the critical value from that distribution for this significance level? v. Calculate your test statistic. vi. Do you reject the null hypothesis or fail to reject it? vii. What can you say about your friend's "powers"? viii. What is the p-value of this test? If you use R. provide your code.

Explanation / Answer

set.seed(2)
lifespans=rexp(100,runif(1,0.01,0.02))
lifespans
mean(lifespans) #Average
#83.64516
var(lifespans) #Variance
#6429.014
sd(lifespans) #standard deviation
#80.18113
s=sum(lifespans)
#8364.516
q1=qchisq(0.025,df=200,lower.tail=FALSE)
#241.0579
q2=qchisq(0.975,df=200,lower.tail=FALSE)
#162.728
#we know confidence interval for exponential distribution is
#(2*sum(x)/chisq(alpha/2,2*n)),(2*sum(x)/chisq(1-alpha/2*n))

#Confidence Interval

a=c((2*s)/q1,(2*s)/q2)
a
#69.3984 102.8037

# Here the null hypothesis is mean = 66.7
# Here the alternative hypothesis is mean != 66.7 (mean not equal to 66.7)

#We should assume normality for the test.

#Critical Values
qnorm(0.025,mean=0,sd=1,lower.tail=FALSE)
qnorm(0.025,mean=0,sd=1,lower.tail=TRUE)

#Test statistic

t=(mean(lifespans)-66.7)/sd(lifespans)
t
#0.2113359
#Here we fail to reject null hypothesis because the
#value of the test statistic lies well within the interval.

p1=pnorm(t,mean=0,sd=1,lower.tail=TRUE)
p2=pnorm(t,mean=0,sd=1,lower.tail=FALSE)

#P-value

2*min(p1,p2)
#0.8326251
#On the basis of p value we also fail to reject the null hypothesis.