You are on page 1of 14

DIGITAL

ASSIGNMEN
T -3
MAT 2001 STATISTICS FOR
ENGINEERS

NAME : HARSHA VARDHAN.D


REG.NO: 17BEC0774
SLOT: L23+L24
Binomial, Poisson and Normal distribution

Problem – 1: A recent national study showed that approximately 55.8% of college students
have used Google as a source in at least one of their term paper. Let X equal the number of
students in a random sample of size n=42 who have used Google as a source:

1. How is X distributed?
2. Sketch the probability mass function (roughly).
3. Sketch the cumulative distribution function (roughly).
4. Find the probability that X is equal to 17.
5. Find the probability that X is at most 13.
6. Find the probability that X is bigger than 11.
7. Find the probability that X is at least 15.
8. Find the probability that X is between 16 and 19, inclusive.
9. Give the mean of X, denoted IE X.
10. Give the variance of X.

Solution:

1. X is a binomial distribution
R – Code:
> dbinom(0:42,42,0.558)
[1] 1.281549e-15 6.795111e-14 1.758581e-12 2.960145e-11 3.643590e-10 3.495868e-09
2.721557e-08 1.766989e-07 9.759416e-07 4.654491e-06 1.939090e-05 7.121431e-05
[13] 2.322521e-04 6.766272e-04 1.769422e-03 4.169751e-03 8.883125e-03 1.715150e-02
3.007333e-02 4.795690e-02 6.962431e-02 9.208231e-02 1.109647e-01 1.218145e-01
[25] 1.217456e-01 1.106618e-01 9.134506e-02 6.833658e-02 4.621664e-02 2.816698e-02
1.540900e-02 7.530189e-03 3.267838e-03 1.250140e-03 4.177669e-04 1.205502e-04
[37] 2.959207e-05 6.058105e-06 1.006318e-06 1.302994e-07 1.233717e-08 7.597553e-10
2.283686e-11
> p=data.frame(0:42,dbinom(0:42,42,0.558))
> round(p,4)
X0.42 dbinom.0.42..42..0.558.
1 0 0.0000
2 1 0.0000
3 2 0.0000
4 3 0.0000
5 4 0.0000
6 5 0.0000
7 6 0.0000
8 7 0.0000
9 8 0.0000
10 9 0.0000
11 10 0.0000
12 11 0.0001
13 12 0.0002
14 13 0.0007
15 14 0.0018
16 15 0.0042
17 16 0.0089
18 17 0.0172
19 18 0.0301
20 19 0.0480
21 20 0.0696
22 21 0.0921
23 22 0.1110
24 23 0.1218
25 24 0.1217
26 25 0.1107
27 26 0.0913
28 27 0.0683
29 28 0.0462
30 29 0.0282
31 30 0.0154
32 31 0.0075
33 32 0.0033
34 33 0.0013
35 34 0.0004
36 35 0.0001
37 36 0.0000
38 37 0.0000
39 38 0.0000
40 39 0.0000
41 40 0.0000
42 41 0.0000
43 42 0.0000

2. R- Code Syntax:
>plot(0:n,dbinom(k,n,p),type="o") # plotting probability mass function of X=k,
n – size, p - probability

Output
>plot(0:42,dbinom(0:42,42,0.558),type="o")
3. R – Code Syntax:
>plot(0:n, pbinom(k,n,p),type=”o”) # plotting cumulative distribution function of
X=k, n – size, p – probability
Output:
>plot(0:42, pbinom(0:42,42,0.558),type="o")
4. R – Code Syntax:
>dbinom(k,n,p) # binomial(n,p) density at k: Pr(X = k)
Output:
> dbinom(17,42,0.558)
[1] 0.0171515

5. R – Code Syntax:
>pbinom(k,n,p) # binomial(n,p) CDF at k: Pr(X <= k)
Output:
> pbinom(13,42,0.558)
[1] 0.001005323

6. R – Code Syntax:
> 1-pbinom(k,n,p) # Pr(X > k)
Output:
>1-pbinom(11,42,0.558)
[1] 0.9999036
7. R – Code Syntax:
> 1-pbinom(k,n,p) # k = X-1, Pr(X>=15)
Output:
> 1-pbinom(14,42,0.558)
[1] 0.9972253
8. R – Code Syntax:
> 1-pbinom(k1,n,p) - 1-pbinom(k2,n,p) #k1 = X1, k2 = X2-1, Pr(19<X<16)
Output:
> pbinom(19,42,0.558)- pbinom(15,42,0.558)
[1] 0.1040649
9. R – Code Syntax:
>x = dbinom(0:n,n,p) # gives bionomial distribution
>x
>IEx = sum(x*p) #gives mean
>IEx
Output:
> n=42
> p=0.558
> x=dbinom(0:42,n,p)
>x
[1] 1.281549e-15 6.795111e-14 1.758581e-12 2.960145e-11 3.643590e-10
[6] 3.495868e-09 2.721557e-08 1.766989e-07 9.759416e-07 4.654491e-06
[11] 1.939090e-05 7.121431e-05 2.322521e-04 6.766272e-04 1.769422e-03
[16] 4.169751e-03 8.883125e-03 1.715150e-02 3.007333e-02 4.795690e-02
[21] 6.962431e-02 9.208231e-02 1.109647e-01 1.218145e-01 1.217456e-01
[26] 1.106618e-01 9.134506e-02 6.833658e-02 4.621664e-02 2.816698e-02
[31] 1.540900e-02 7.530189e-03 3.267838e-03 1.250140e-03 4.177669e-04
[36] 1.205502e-04 2.959207e-05 6.058105e-06 1.006318e-06 1.302994e-07
[41] 1.233717e-08 7.597553e-10 2.283686e-11
> IEx = sum(x*p)
> IEx
[1] 0.558

11. R – Code Output:


> var = sum((x-IEx)^2*x)
> var
[1] 0.2226331

R - Coding:
Problem – 2: The number of traffic accidents that occur on a particular stretch of road
during a month follows a Poisson distribution with a mean of 7.6.
1. Find the probability that less than three accidents will occur next month on this
stretch of road.
2. Find the probability of observing exactly three accidents on this stretch of road next
month.
3. Find the probability that the next two months will both result in four accidents each
occurring on this stretch of road.
4. Check the mean and variance of the poisson distribution.
5. Plot the Poisson distribution and compare with binomial distribution.
Solution:
1. R – Code:
>sum(dpois(0:2,7.6))
Output:
[1] 0.01875692
2. R – Code:
> dpois(3,7.6)
Output:
[1] 0.03661436
3. R – Code:
>(dpois(4,7.6))^2
Output:
[1] 0.004839607
4. Consider 100 accidents that occur on a particular stretch of road during a month.
R – Code:
> x.val = 0:100
> p.val = dpois(x.val,7.6)
> Ex = sum(x.val*p.val) #mean
> Ex
[1] 7.6
> var = sum((x.val-Ex)^2*p.val) #variance
> var
[1] 7.6

5. R – Code:
>plot(0:30,dpois(0:30,7.6),type="h",main="Poisson Distribution(mu=7.6)")
>plot(0:30,dbinom(0:30,30,7.6/30),type="h",main="Binomial Distribution(mu=7.6)")
Output:
Poisson distribution is more accurate than Binomial Distribution.
R – Coding:
Problem – 3: 1000 students had written an examination the mean of test is 35 and
standard deviation is 5. Assuming the distribution to be normal find:
1. How many student’s marks lie between 25 and 40?
2. How many students get more than 40?
3. How many students get below 20?
4. How many students get 50?

Solution:
1. R – Code:
>(pnorm(40,mean=35,sd=5)-pnorm(25,mean=35,sd=5))*1000
Output:
[1] 818.5946
2. R – Code:
>(1-pnorm(40,mean=35,sd=5))*1000
Output:
[1] 158.6553
3. R – Code:
> (pnorm(20,mean=35,sd=5))*1000
Output:
[1] 1.349898
4. R – Code:
> (dnorm(50,mean=35,sd=5))*1000
Output:
[1] 0.8863697
R – Coding:

You might also like