# 程序代写 ################################################### – cscodehelp代写

###################################################
# 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.

###################################################
# Tutorial 4a, Question 1

#(i)
1 – pbinom(…)
# Note that this can also be computed as
pbinom(11,20,0.6,lower.tail = FALSE)

#(ii)

###################################################
# Tutorial 4a, Question 4(a)

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.

###################################################
# Tutorial 4a, Question 5

#Using binom
pbinom(…)

#Using Poisson

###################################################
# Tutorial 4b, Questions 2(b),(c):

#(b)
p1 = pexp(40,0.05); p.one

#(c)

###################################################
# Tutorial 4b, Questions 3(a), (c), (d):

#(a)
p.ta = pnorm(…)

#(c)

#(d)

###################################################
# Tutorial 4b, Question 4(c):

p.a = ( pnorm(…) – pnorm(…) ) / 0.88

###################################################
## 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.