In: Statistics and Probability
Plot the probability mass function (PMF) and the cumulative distribution function (CDF) of 3 random variables following (1) binomial distribution [p,n], (2) a geometric distribution [p], and (3) Poisson distribution [?]. You have to consider two sets of parameters per distribution which can be chosen arbitrarily. The following steps can be followed: Setp1: Establish two sets of parameters of the distribution: For Geometric and Poisson distributions take two values of p (p1 and p2) and take two values of [?], (?1 and ?2) respectively. For the binomial you should take two values of p and two values of n, first keep p fixed and change n, in the second keep n fixed and change p. Step 2: Generate the random variables (at least 10 values) [column 1] Step 3: Calculate the PMF [column 2] and CDF [column 3] Step 4: Plot the PMF and CDF in different graphics (It is recommended to combine the graphics while changing the parameters). Comment on how the parameters values affect the distribution.
ANSWER::
I am using R, I am providing the R code here, one can replicate and generate new graphs from this code by varying the repeatations and value of the parameters,
Here is the code for geomteric
##geometric
p1=0.5
p2=0.25
x1=rgeom(50,p1)
x2=rgeom(50,p2)
hist(x1,breaks=30,col="black", main="PMF of
Geo(0.5)")
hist(x2,breaks=50,col="black", main="PMF of
Geo(0.25)")
plot(ecdf(x1),main="CDF of Geo(0.5)")
plot(ecdf(x2),main="CDF of Geo(0.25)")
and here are the plots
Here as we see when lowered the parameter, we get much more values in the distribution as expected, the structire of the distribution however remains same
Now for Poisson
##Poisson
p1=3
p2=8
x1=rpois(50,p1)
x2=rpois(50,p2)
dev.new()
par(mfrow=c(1,2))
hist(x1,breaks=30,col="black", main="PMF of
Pois(3)")
hist(x2,breaks=50,col="black", main="PMF of
Pois(8)")
dev.new()
par(mfrow=c(1,2))
plot(ecdf(x1),main="CDF of Pois(3)")
plot(ecdf(x2),main="CDF of Pois(8)")
Now for the plots
Here also we see even though the bell shaped structure of the distribution remains same in both the cases. Increasing the parameter increases the spread of the distribution
Finally for Binomial
First we keep n constant and vary p
##binomial
p1=0.5
p2=0.25
n1=10
n2=20
x11=rbinom(100,n1,p1)
x12=rbinom(100,n1,p2)
dev.new()
par(mfrow=c(1,2))
hist(x11,breaks=40,col="black", main="PMF of
Binom(10,0.5)")
hist(x12,breaks=40,col="black", main="PMF of
Binom(10,0.25)")
dev.new()
par(mfrow=c(1,2))
plot(ecdf(x11),main="CDF of Binom(10,0.5)")
plot(ecdf(x12),main="CDF of Binom(10,0.25)")
The plots are
Interesting to see the change of structure in the two cases, although the domain remains same p1=0. gives symmetric distribution whereas p1=0.25 gives a skewed one
Now keep p=0.5 and vary n
p1=0.5
p2=0.25
n1=10
n2=50
x11=rbinom(100,n1,p1)
x12=rbinom(100,n2,p1)
dev.new()
par(mfrow=c(1,2))
hist(x11,breaks=40,col="black", main="PMF of
Binom(10,0.5)")
hist(x12,breaks=40,col="black", main="PMF of
Binom(50,0.5)")
dev.new()
par(mfrow=c(1,2))
plot(ecdf(x11),main="CDF of Binom(10,0.5)")
plot(ecdf(x12),main="CDF of Binom(50,0.5)")
The plots here are
NOTE:: I HOPE YOUR HAPPY WITH MY ANSWER....***PLEASE SUPPORT ME WITH YOUR RATING...
***PLEASE GIVE ME "LIKE"...ITS VERY IMPORTANT FOR ME NOW....PLEASE SUPPORT ME ....THANK YOU