Use R to generate random number samples. The life time of a laser (in hours) is
ID: 3697409 • Letter: U
Question
Use R to generate random number samples.
The life time of a laser (in hours) is exponentially distributed with lambda= 1/80. Two such
lasers are operating independently.
a) Use a simulated sample of size 1000 to estimate the probability that the sum of the two
lifetimes is greater than 100 hours.
b) Estimate the probability that the both lasers last more than 50 hours.
Notes:
To generate random numbers you use the following R commands:
a) uniform distribution- “runif(n, min=0, max=1)”
b)gamma distribution “rgamma(n, shape=alpha, scale=beta)
c) exponential distribution “rexp(n, lambda)
Explanation / Answer
Of course, when you run this, you'll get a different number, but it will definitely be between 5.0 and 7.5. You won't get the values 5.0 or 7.5 exactly, either.
If you want to generate multiple random values, don't use a loop. You can generate several values at once by specifying the number of values you want as the first argument to runif. Here's how to generate 10 values between 5.0 and 7.5:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.