Statistics and probability in R
D1 is a fair dice
1)build the pmf table in R
2)find the varience using formual E[D1- − µ]^2 and shortcut formula E[D^2 ] − [E(D)]^2 = E[D^2 ] − µ^2 in R
3)find the standard deviation in R
I'm looking for the R code to learn how to do it.
The sample space for one throw of a 6 sided fair die is .
Each outcome is equally likely with probability .
1) The PMF table is
1 | 2 | 3 | 4 | 5 | 6 | |
2) The varianc is defined as
Here,
The second moment is
The R code for finding variance and standard deviation is given below
D <- c(1,2,3,4,5,6)
p <- 1/6
ED <- sum (p*D)
ED2 <- sum (p*D^2)
VD1 <- sum (p*(D-ED)^2)
VD2 <- ED2 - ED^2
SD <- sqrt(VD1)
VD1
VD2
SD
The output is
> VD1
[1] 2.916667
> VD2
[1] 2.916667
> SD
[1] 1.707825
3) Testandard devbaition is .
Get Answers For Free
Most questions answered within 1 hours.