###################################################
# Computer Lab 3 – F71SM
###################################################
## In the tasks below, fill in any missing code as
## required.
##
## Make sure you use the help menus in R (e.g.”?mean”
## will open up a help window for “mean()”).
##
## In some cases, the numerical answers you will find
## may be slightly different from those in the tutorial
## answers, due to rounding in intermediate steps.
###################################################
## Task 1
# Tutorial 4a, Question 1
# Confirm the answers
#(i)
1 – pbinom(…)
# Note that this can also be computed as
pbinom(11,20,0.6,lower.tail = FALSE)
#(ii)
…
###################################################
## Task 2
# Tutorial 4a, Question 4(a)
# Confirm the answers
p.more.three = 0.4^3; p.more.three
# Note that alternatively, we can use pgeom() in R
# But notice that R uses the version of geometric
# distn that corrsponds to “no. of failures before
# first success”, i.e. x = 0,1,2,…
# So “more than 3 attempts until passing” is the same
# as “more than 2 failures before passing”, i.e.
…
###################################################
## Task 2
# Tutorial 4a, Question 5
# Confirm the answers
#Using binom
pbinom(…)
#Using Poisson
…
###################################################
## Task 4
# Tutorial 4b, Questions 2(b),(c):
# Confirm the answers
#(b)
p1 = pexp(40,0.05); p.one
…
#(c)
…
…
###################################################
## Task 5
# Tutorial 4b, Questions 3(a), (c), (d):
# Confirm the answers
#(a)
p.ta = pnorm(…)
#(c)
…
#(d)
…
###################################################
## Task 6
# Tutorial 4b, Question 4(c):
# Confirm the answers
p.a = ( pnorm(…) – pnorm(…) ) / 0.88
…
…
###################################################
## Task 7
## Write a function in R that plots the graph of the
## cdf of a specified normal distribution and also returrns
## two specified quantiles of the distribution.
## The parameters of the distribution and the probabilities
## for the required quantiles should be specified by the user
## when the function is called.
…