Question 1
- The probability distribution of a fair dice
The probability distribution for X number of heads (H) after D number of tosses is binomial with parameters and
To get the joint PMF table, the conditional probabilities are multiplied by which is the probability of rolling the dice.
DX | 1 | 2 | 3 | 4 | 5 | 6 |
0 | ||||||
1 | ||||||
2 | 0 | |||||
3 | 0 | 0 | ||||
4 | 0 | 0 | 0 | |||
5 | 0 | 0 | 0 | 0 | ||
6 | 0 | 0 | 0 | 0 | 0 |
Marginal probabilities
+
Therefore,
Therefore,
Therefore,
Thus,
Thus,
Therefore,
Question 4
- The poisson distribution converges to a normal distribution for sufficiently large . The mean and variance of the normal distribution are both equal to
Code for random generation for poisson distribution
rpois(20,10) where 20 is the number of distributions and
The numbers generated are
rpois(20,10)
[1] 12 9 16 9 8 7 11 7 15 6 10 7 10 4 9 15 12 8 7 14
As seen from the comparison of the different poisson distributions with different lambda to their corresponding normal distributions, the poisson distribution converges towards the normal with increase in lambda.
- The chi-square distribution is the sum of independent random variables with finite mean and variance. It therefore converges to a normal distribution for large values. The normal distribution has a variance of twice the degrees of freedom of the chi-square test.
df = 9
x = seq(1,16,0.05)
pxd <- matrix(ncol=df, nrow=length(x))
for(i in 1:df){
pxd[,i] <- pchisq(x, i, lower.tail = F)
}
pxd <- data.frame(pxd)
colnames(pxd) <- c(1:df)
pxd <- cbind(x, pxd)
pxd <- gather(pxd, df, px, -x)
ggplot(pxd, aes(x, px, color=df)) +
geom_line() + xlab(“chi-square”)+ylab(“p-value”)
Running the code yields,
As seen, the shape of the chi-square distribution gradually towards looking as a normal distribution as the number of degrees of freedom increases.
Coding
plot( dpois( x=0:10, lambda=6 ))
x = 0:20; pdf = dpois(x, 6)
plot(x, pdf, type=”h”, lwd=3, col=”blue”,
main=”PDF of POIS(6) with Approximating Normal Density”)
abline(h=0, col=”green2″)
curve(dnorm(x, 6, sqrt(6)), lwd=2, col=”red”, add=T) # ‘x’ mandatory arg
The addition of two independent Poisson functions yields a Poisson distribution where
Question 5
The condition of X given Y=y is given by
Thus,
For a Poisson distribution, the probability of observing x events is given as
Therefore,
- Suppose a person walks into a house with 10 doors and he has to walk past all the doors. The possibility that the person may find a door locked is the same. The event is binomial because of the fixed number of doors and the independence of each event.