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

This exercise will give you a little practice with R. The command Q = rexp(n, ra

ID: 3109643 • Letter: T

Question

This exercise will give you a little practice with R. The command Q = rexp(n, rate) produces a sequence Q = {Q_1, ..., Q_n} of exponentially distributed random numbers. Bear in mind that the argument rate is the parameter of the distribution, not the mean. The command Q[k] gives Q_k and Q[k:m] the subsequence {Q_k, Q_m}. a. Since the mean of the exponential distribution is 1/rate, it should be that Q 1/rate rate where Q = 1/n sigma^n_j = 1 Q_j is the sample mean. Test the approximation (4) with rate = .25 and n = 1000. Use the R command mean to compute Q. b. Generate a new sequence of exponentially distributed interarrival times T = {T_1, ....., T_6} with rate parameter .4/minute. Use the command cumsum to produce the corresponding sequence a = {a_1, ....a_6} of arrival times. c. In class we saw that the random variable A_6 = T_1 + .... T_6 was gamma distributed with shape parameter 6 and rate parameter .4. Use pgamma to compute P(a_6 > 3).

Explanation / Answer

Part (a):

n = 1000
rate = 0.25
Q = rexp(n, rate)
Q_mean_actual = mean(Q)
Q_mean_approx = 1/rate
Q_mean_actual
Q_mean_approx

Part (b):

n = 6
rate = 0.4
T = rexp(n, rate)
a = cumsum(T)
T
a

Part (c):

n = 6
rate = 0.4
T = rexp(n, rate)
a = cumsum(T)
T
a

shape = 6
x = pgamma(3, shape=shape, rate=rate)
x

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote