In: Math
Roll two ordinary dice and let X be their sum. Draw the pmf and cmf for X. Compute the mean and standard deviation of X. Solve using R studio coding.
Here we have sampling with replacement. There are
outcomes each with equal probability
.
The random variable
representing the sum of the numbers on the balls has values from 2
to 12.
The CMF is
The R code for plotting PMF and CMF given below.
plot(1:1)
dev.new()
X <- seq(2,12,1)
PX <- c(1,2,3,4,5,6,5,4,3,2,1)/36
plot(X,PX, type="h", col="blue", lwd=2, xlab="X", ylab = "P(X=x)",
main="PMF of X")
plot(1:1)
dev.new()
X <- seq(2,12,1)
FX <- c(1,3,6,10,15,21,26,30,33,35,36)/36
plot(X,FX, type="h", col="blue", lwd=2, xlab="X", ylab = "F(X=x)",
main="CMF of X")
The PMF is plotted below.
The CMF is plotted below.
The mean is
R code below.
X <- seq(2,12,1)
PX <- c(1,2,3,4,5,6,5,4,3,2,1)/36
EX <- sum(X*PX)
EX
The standard deviation is
R code below.
X <- seq(2,12,1)
PX <- c(1,2,3,4,5,6,5,4,3,2,1)/36
EX2 <- sum(X^2*PX)
EX2
sqrt(EX2-7^2)