The data below represents the time between arrivals of customers at Dairy Queen
ID: 3368872 • Letter: T
Question
The data below represents the time between arrivals of customers at Dairy Queen on a Sunday afternoon (in minutes):
0.02 0.22 0.53 0.91 1.45
0.04 0.24 0.55 1.16 1.59
0.06 0.29 0.56 1.22 1.62
0.06 0.31 0.61 1.22 1.73
0.07 0.37 0.74 1.27 2.02
0.16 0.49 0.86 1.28 2.33
0.19 0.50 0.90 1.28 3.41
0.22 0.51 0.91 1.41 3.65
(a) Use the chi-square goodness-of-fit test to determine if the data is exponentially distributed. Use ?=0.01.
(b) Use the K-S test to determine if the data is exponentially distributed. Use ?=0.01.
Explanation / Answer
a) Here R-code is as;
x=c(0.02,0.22,0.53,0.91,1.45,0.04,0.24,0.55,1.16,1.59,0.06,0.29,0.56,1.22,1.62,0.06,0.31,0.61,1.22,1.73,0.07,0.37,0.74,1.27,2.02,0.16,0.49,0.86,1.28,2.33,0.19,0.5,0.9,1.28,3.41,0.22,0.51,0.91,1.41,3.65)
x1=table(cut(x,c(seq(0,4,0.5))))
d=data.frame(x1)$Freq
t=seq(0,4,0.5)
q={}
for(i in 1:length(t)-1)
{
q[i]=pexp(t[i+1],(1/mean(x)))-pexp(t[i],(mean(x)))
}
e=40*q
chisq.test(d,e)
The output is as;
> chisq.test(d,e)
Pearson's Chi-squared test
data: d and e
X-squared = 48, df = 42, p-value = 0.2426
Warning message:
In chisq.test(d, e) : Chi-squared approximation may be incorrect
b)The R-code is as;
x=c(0.02,0.22,0.53,0.91,1.45,0.04,0.24,0.55,1.16,1.59,0.06,0.29,0.56,1.22,1.62,0.06,0.31,0.61,1.22,1.73,0.07,0.37,0.74,1.27,2.02,0.16,0.49,0.86,1.28,2.33,0.19,0.5,0.9,1.28,3.41,0.22,0.51,0.91,1.41,3.65)
fitdistr(x,"exponential")
ks.test(x,"pexp",1.0822511)
Output is as;
> ks.test(x,"pexp",1.0822511)
One-sample Kolmogorov-Smirnov test
data: x
D = 0.090041, p-value = 0.9019
alternative hypothesis: two-sided
In above both of test having p-value is greatre than 0.01. Thus we accept the null hypothesis as the the data is exponentially distributed.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.