Chapter 3&4 Flashcards
Importance of geometric distributions?(1)
SImilar to python, add one on so probability for 2 in formula would give prob less than 3
Difference between d”distribution” and p”distribution” and r”distribution” for functions?(1)
d is pmf, p is cdf, r is a random sample from the distribution,
d for equal to probabilities, p for less than or equal to
Answer:
: Suppose annual maximum wave heights observed off the coast at a flood-prone
town are assumed Normally distributed, with mean 2 metres and standard deviation 0.5 metres.
Write down the R command to estimate the height of a new sea wall such that we might
expect the town to be flooded, on average, once per century. Why might our modelling
assumption be invalid?
qnorm(0.99, 2, 0.5)
3.16 design it to 3.16m.
For doing questions for formulas in R?(1)
Take care in difference in time units!!!
1)Use R to generate a sample of size 10,000 from an exponential distribution with
rate 2.5, and store this sample in the vector x
2)Use your vector x to estimate Pr(X ≤ 0.5), where X ∼ Exp(2.5).
3) How does your estimate in part (a) compare to the true probability?
1) x=rexp(10000, 2.5)
2) y=x[x<=0.5], length(y)/10000=0.7109
3) pexp(0.5, 2.5)
0. 71…., pretty well, more samples=more accurate
Issues with binomial?(1)
Expects constant rate.
How do you denote CDFs?(1)
By F(x)
Why does a CDF graph for a normal distribution have an asymptote at 1 rather than touching it?(1)
Because of the asymptotic nature of the bell shape of its distribution never touching the x-axis.
Pdf for an exponential distribution can be written in closed form as?What about the CDF?(2)
fsubcriptx(x)=lambdae^-lambdax
Fsubscript(x)=1-e^-lambdax
What is the inverse CDF method?(1)
Let U ∼ U(0, 1). Suppose F (x) is a well-defined CDF which is invertible. Then the random
variable X = F^−1(U) has CDF F (x)
Proof for inverse CDF method.(1)
X=F^-1(U) therefore Pr(X<=x)=Pr(F^-1(U)<=x) Pr(F(F^-1(U)<=F(x)) Pr(U<=F(x)) =F(x)
How would you do write a simulation in R to produce realisations (observed value) from the distribution?(1)
inv.function= function(n){
U=runif(n)
answer=inverse cdf with U in place of x
return(answer)}
Then run histograms of these with samples of 1000,10000
Could then overlay pdf by findin gthis through differentiation then making function in r by generating the coordinates and using lines command (see week 4 synchronous lecture for this solution).
What is the rweibull function in R?(1)
rweibull=(n, scale=lambda, shape=kappa)
How do you get from PDF to CDF? Vice versa?(1)
integrate, differentiate.
Looking at example 4.5 in the notes, what do you need to remember?(1)
Look at this example at all parts as lots of things to note, eg negatives in a quadratic, how to sketch, how to convert different parts of the pdf and which parts to include. Will be useful for exam revision!