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

Can Someone help me slove the exponential distribution problem with R program. I

ID: 3761983 • Letter: C

Question

Can Someone help me slove the exponential distribution problem with R program. I have no idea about R.

Consider the network pictured below

As in previous network problems, assume that A, B and C are switches. The network will work if there
is a path from the left side to the right side that has no broken switches.

For instance, suppose that:
? Switch A fails after 6 months
? Switch B fails after 8 months
? Switch C fails after 14 months

When does the lower branch (B and C) fail? When does the network fail?

If instead the switch failure times were X for switch A, Y for switch B and Z for switch C, can you write a formula for:

? The time at which the lower branch fails?

? The time at which the network fails?

Now that you have a formula for the time that the network fails, we can use simulation (in R) to calculate the continuous probability distribution of W = time of network failure, by simulating values of X, Y and Z, and plugging them into the network failure time formula.

Try out the code below(with R), write down what happens and briefly explain it.

switchfail = rexp(3,rate=0.5)
switchfail
max(switchfail[1],min(switchfail[2],switchfail[3]))


Now we’ll try it for many repetitions of the same process. The code below does this.

calcfail = function(x){
max(x[1],min(x[2],x[3]))
}

calcfail(switchfail)

n = 100000
netfail = rep(-1,n)
switchfail = matrix(rexp(n*3,rate=0.5),ncol=3)
for (i in 1:n){
netfail[i] = calcfail(switchfail[i,])
}

Explanation / Answer

1.

> whale = c(74, 122, 235, 111, 292, 111, 211, 133, 156, 79)

> mean(whale)

[1] 152.4

> var(whale)

[1] 5113.378

> std(whale)

Error: couldn’t find function "std"

> sqrt(var(whale))

[1] 71.50789

> sqrt( sum( (whale - mean(whale))^2 /(length(whale)-1)))

[1] 71.50789

> std = function(x) sqrt(var(x))

> std(whale)

[1] 71.50789

> sd(whale)

[1] 71.50789

2.

> results = c();

> mu = 0; sigma = 1

> for(i in 1:200) {

+ X = rnorm(100,mu,sigma) # generate random data

+ results[i] = (mean(X) - mu)/(sigma/sqrt(100))

+ }

> hist(results,prob=T)

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