Question 1

A)

K ~ N(410, 12)

kooknorm <- qnorm(0.95, mean = 410, sd = 12)
kooknorm
## [1] 429.7382

Therefore, the weight of a laughing kookaburra to be considered in the heaviest 5% is approximetely 429.7g

B)

\[P(400g \le K \le 420g)\]

medkook <- pnorm(420, mean = 410, sd = 12) - pnorm(400, mean = 410, sd =12)
medkook
## [1] 0.5953432

The probability a randomly selected laughing kookaburra is classed medium sized between 400g and 420g is roughly 59.5%.

C)

Let X follow a geometric distribution. As X is a count of the number of laughing kookaburras below the medium weight. The random sampling procedure ensures observations are independent, weight below medium threshold is considered a success and included in the medium threshold is considered a failure. The probability of success is constant and given by 1-medkook object in part b) as it is the compliment of a kookaburra being a medium weight.
X ~ G(3, 1 - 0.5953432) , for X = 1,2,3,4

kook_geom <- dgeom(x = 3, prob = 1- medkook)
kook_geom
## [1] 0.08538647

The probability that the first medium sized laughing kookaburra is the third kookaburra weighed is approximately 8.5%. ## C) Y satisfies the criteria for a negative binomial distribution because Y is the count of randomly sampled small and medium sized kookaburra’s before before there is an 80% of finding 10 which are medium sized. Y also has constant probability of success; \(1 - P(400g \le X \le 420g)\). There are two outcomes, kookaburra’s being classed as medium and large. Classifying not medium a success, and medium a failure.

x = 10
q = 0.8
# 80% quartile. 
p = 1 - medkook
# probability of not medium weight.
qnb <- qnbinom(q, x, p)
# negative binomial function.
qnb
## [1] 20

To find ten medium sized laughing kookaburra’s with a guarantee of 80%, a minimum of 20 randomly selected kookaburra’s would have to be weighed. # Q2 ## A) X will follow a poisson process distribution as the 15 service calls are independent to each event by the random sampling procedure \(\lambda = np = 15*0.03 = 0.45\) and X is the count of the number of service calls over a given time interval, 5 minutes. \(X \sim P(0.45)\)

pcalls <- dpois(x=5, lambda = 0.45)
pcalls
## [1] 9.805027e-05

Therefore we would expect approximately 0 of the service calls out of the 15 randomly sampled service called to go over 5 minutes.

B)

pcalls <- 1- ppois(q=3, lambda = 0.45)
pcalls
## [1] 0.001195352

There is approximately a 0.001% chance that 3 out of 15 callers would wait over 5 minutes.

C)

Yes there claim seems to be accurate on the sample taken. With no probability given above to indicate any caller out of the sample of 15 has had a call over 5 minutes before reaching a service technician.

D)

\[P(X \ge 5) = 1 - P(X <5)\]

Using the exponential distribution, there is a 13.6% chance a randomly selected caller will wait at least 5 minutes until reaching a service technician

n.sim = 100000
exp.dist <- rexp(n = n.sim, rate = 0.4)
hist(exp.dist, col = "green3", xlab = "Minutes", ylab = "Call Frequency", 
     main = "Exponential Distribution of Service Calls")

#Probability 5 minutes and over
sum(exp.dist>=5)/n.sim
## [1] 0.13484
#e)
mean(exp.dist)
## [1] 2.505775
#f)
median(exp.dist)
## [1] 1.736544

E)

The average length of time a caller must wait before reaching a service technician is given by the mean function to the object exp.dist (exponential distribution derived) and equals approximately 2.5 minutes.
##F) The median length call time is given by the median function to exp.dist object and is approximately equal to 1.73 minutes.

Q3

A)

Both random variables E and V follow a Poisson distribution as the two events of earthquakes and volcanic eruptions are independent events. Both events occur at constant rates per, where \(\lambda_E = 55\) and \(\lambda_V = 0.15\). Where both variables are a count of events until either an earthquake or volcanic eruption happen in a given time interval. ## B)

C)

disaster <- rpois(n=n.sim, lambda = 55.15) #random poisson process simulation
p_disaster <- (sum(disaster=60)/n.sim)*100 #Percentage of exactly 60 disasters
p_disaster
## [1] 0.06

On a randomly selected day, using 100000 simulations. The theoretical probability that exactly 60 earthquakes and volcanic eruptions take place is equal to 0.06%

D)

A, the time until the 100th earthquake follows in accordance to a poisson process.Earthquakes are assumed to be independent of each other. A, has a constant rate of occurrence being 55/day.
B, the time until the the first volcanic eruption in accordance to a poisson process. Eruptions are independent of each other. B, has a constant rate of occurrence of 0.15/day.
The difference in the distributions is that A, is an event that has happened and we want to find when the 100th event will occur. Therefore A ~ Gamma(100, 55). With B, the event has not occurred yet and we want to find a probability of when that event will occur in time. Therefore there is no alpha parameter to measure, simply B ~ Exp(0.15).

E)

The proportion of vectors B-A which are less than zero equal 23.676%.

A <- rgamma(n.sim, shape = 100, rate = 55)
B <- rexp(n.sim, rate = 0.15)
difference <- B - A
prob_difference <- (sum(difference < 0)/n.sim)*100
prob_difference
## [1] 24.048

4

##A)

X <- seq(0,1, length = n.sim) # 0 <= Y <= 1
Y <- runif(X) # Random uniform distribution 
theta <- sqrt(14) 
X.PIT <- theta*sqrt(-2*log(1-Y))
hist(X.PIT, col = "papayawhip") # b) Histogram of transformed random variable Y

sum(X.PIT)/n.sim; median(X.PIT); IQR(X.PIT); sd(X.PIT) # b) and ) 
## [1] 4.691746
## [1] 4.417189
## [1] 3.376256
## [1] 2.448041

B)

From the histogram, a clear transformation of the uniform distribution to a slightly right skewed normal distribution. A skewness coefficient of 0.63 gives further evidence of a slight skew. The mean and median of X.PIT equal 4.69 as expected, and 4.42 respectively. The interquartile range and standard deviation equal 3.397998 and 2.451905 respectively.

C)

Answered in part b) by summing the values of X.PIT over the 100000 simulations, where E(X) = 4.69.

D)

prob.mod <- sum(X.PIT<=5.5)/n.sim
prob.mod
## [1] 0.66167

Roughly 66% of days in cloudville have the UV risk classed as moderate or below. ## E) In the domain \(0 \leq w \leq 1\), the derivative of w will always be greater than one, therefore it is a monotonically increasing function of x. Note from the plot, w(x) is not decreasing over the domain of 0 to 1. ## G)

W.trans <- X.PIT^2/2*theta^2 #applying transformation to values of X in part a)
hist(W.trans)

The transformation was performed by substituting values generated from part a) into the equation for part e). ## H)

w <- rexp(n.sim, rate = 1)
sum(w)/n.sim # mean
## [1] 0.9993553
var(w) # Variance
## [1] 0.999256

As expected, the mean and variance are approximately equal to one from the 100000 values generated.