In: Statistics and Probability
Plot using RStudio
Consider a binomial random variable, X.
i. Plot the pmf of X ∼Bin(n = 10, p = 0.3).
ii. Plot the pmf of X ∼Bin(n = 10, p = 0.7).
iii. Plot the pmf of X ∼Bin(n = 100, p = 0.3).
iv. What happens to the shape of the pmf of X ∼Bin(n, p) when p gets larger?
v. What happens when n gets larger
Solution:
We are given that: X follows a Binomial distribution.
We have to plot the pmf of X for given parameters using R code.
i) Plot the pmf of X ∼Bin(n = 10, p = 0.3).
we use following R code:
x<- seq(0,10,by =1)
y<-dbinom(x,10,0.3)
plot(x,y)
Thus we get following plot:
ii. Plot the pmf of X ∼Bin(n = 10, p = 0.7).
x<- seq(0,10,by =1)
y<-dbinom(x,10,0.7)
plot(x,y)
iii. Plot the pmf of X ∼Bin(n = 100, p = 0.3).
x<- seq(0,100,by =1)
y<-dbinom(x,100,0.3)
plot(x,y)
iv. What happens to the shape of the pmf of X ∼Bin(n, p) when p gets larger?
From part i and ii, we can see as p gets larger , shape of pmf shifts from left skewed distribution to right skewed distribution.
v. What happens when n gets larger
From part iii) we can see as value of n gets larger, the shape of pmf becomes approximately Normal.