Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

ASHWIN RAJ

21BEC0400
EXPERIMENT 3
BINOMIAL, POISSON AND NORMAL DISTRIBUTION

QUESTION 1
It is known that probability of an item produced by a certain machine will be defective is
0.05. If the produced items are sent to the market in packets of 20, then write down the R
code to find the number of packets containing at least, exactly and at most 2 defective items
in a consignment of 1000 packets

AIM: To find numbers of packets containing at least, exactly and at most 2 defective items in
a consignment of 1000 packets
R Programming

CODE

n=20
p=0.05
q=1-p
N=1000
k=2
N1=round(N*(1-pbinom(k-1,n,p)))
N1
k=2
N2=round(N*(dbinom(k,n,p)))
N2
N3=round(N*(pbinom(k,n,p)))
N3

OUTPUT

CONCLUSION
1. Number of packets containing at least 2 defective items in a consignment of 1000packets
are 264
ASHWIN RAJ
21BEC0400
2. Number of packets containing exactly 2 defective items in a consignment of 1000 packets
are 189
3. Number of packets containing at most 2 defective items in a consignment of 1000 packets
are 925

QUESTION 2

A car hire firm has 2 cars which it hires out day by day. The number of demands for a car on
each day follows a Poisson distribution with mean 1.5. Write down the R code to compute the
proportion of days on which (i). neither car is used, (ii). at most one car is used and (iii).
some demand of car is not fulfilled.

AIM: To find proportion of days on which (i). neither car is used, (ii). at most one car is used
and (iii). some demand of car is not fulfilled.

R PROGRAMMING

CODE

# Y denotes number of car hired a day. Y follows P(1.5)


#P(Y=0)
dpois(0,1.5)
#P(Y<=1)
ppois(1,1.5)
#P(Y>2)
1-ppois(2,1.5)

OUTPUT

CONCLUSION
1. Neither car is used are 0.2231302
2. Atmost one car used are 0.5578254
3. Some demand of car is not fulfilled is 0.1911532
ASHWIN RAJ
21BEC0400

QUESTION 3
The local corporation authorities in a certain city install 10,000 electric lamps in the streets of
the city with the assumption that the life of lamps is normally distributed. If these lamps have
an average life of 1,000 burning hours with a standard deviation of 200 hours, then write
down the R code to calculate the number of lamps might be expected to fail in the first 800
burning hours and also the number of lamps might be expected to fail between 800 and 1,200
burning hours.

AIM : To find number of lamps might be expected to fail in the first 800 burning hours and
also the number of lamps might be expected to fail between 800 and 1,200 burning hours

R PROGRAMMING

CODE

#Z denotes lifetime of bulbs. Z follows N(1000,200)


#number of lamps with Z<800
round(10000*pnorm(800,1000,200))
#number of lamps with 800<Z<1200
round(10000*(pnorm(1200,1000,200)-pnorm(800,1000,200)))

OUTPUT

CONCLUSION

1.number of lamps expected to fail in first 800 hours are 1587


2.the number of lamps expected to fail between 800 to 1200 burning hours are 6827

You might also like