Sa 123
Sa 123
Sa 123
PROBLEM 1
If the chance that an individual suffers a bad reaction from a certain injection is 0.001. Determine
the probability that out of 2000 individuals
a. exactly 3,
b. at least 100,
c. at most 15,
d. between 20 and 35 will suffer from a bad reaction.
Also, compute how many individuals will have a chance of 25% to suffer from a bad reaction.
SOLUTION:
> n=2000
> p=0.001
> lambda=n*p
> lambda
[1] 2
> #(a)Exactly 3
> ppois(15,lambda,lower.tail=T)
[1] 1
[1] 6.106227e-15
PROBLEM 2
X 0 1 2 3 4 5 6 7 8 9 10
f(X) 6 20 28 12 8 6 0 0 0 0 0
> #f(x)=(6,2,0,2,8,1,2,8,6,0,0,0,0,0)
> #Σfi=80
> #x*f(x)=(0,20,56,36,32,30,0,0,0,0)
> #Σx.f(x)=174
> mean=174/80
> mean
[1]2.175
> n=10
> p=2.175/n
>p
[1] 0.2175
> q=(1-p)
>q
[1] 0.7825
> N=80
> x0=dbinom(0,10,0.2175)*N
> x0
[1] 6.885468
> x1=dbinom(1,10,0.2175)*N
> x1
[1] 19.13852
> x2=dbinom(2,10,0.2175)*N
> x2
[1] 23.93844
> x3=dbinom(3,10,0.2175)*N
> x3
[1] 17.74351
> x4=dbinom(4,10,0.2175)*N
> x4
[1] 8.630827
> x5=dbinom(5,10,0.2175)*N
> x5
[1] 2.878781
> x6=dbinom(6,10,0.2175)*N
> x6
[1] 0.6668102
> X<-c(0,1,2,3,4,5,6,7,8,9,10)
> f<-c(6.880,19.138,23.938,17.743,8.630,2.878,0.666)
> print=data.frame(x,f)
> print
x f
1 0 6.880
2 1 19.138
3 2 23.938
4 3 17.743
5 4 8.630
6 5 2.878
7 6 0.666
> X1<-(4*X+3)
> X1
[1] 3 7 11 15 19 23 27 31 35 39 43
> Lprint1=data.frame(X,X1)
> print1
x f
1 0 6.880
2 1 19.138
3 2 23.938
4 3 17.743
5 4 8.630
6 5 2.878
7 6 0.666
X1<-(4*X+3)
> X1
[1] 3 7 11 15 19 23 27 31 35 39 43
> print1=data.frame(X,X1)
> print1
X X1
103
217
3 2 11
4 3 15
5 4 19
6 5 23
7 6 27
8 7 31
9 8 35
10 9 39
11 10 43
>plot(print1)
PROBLEM 3
800 students appear for an examination. It was found that the marks are normally
distributed with mean 60 and standard deviation 12. The students who get more than or
equal to 60 will be placed in 1st division, who get between 50 and 60 will be placed in 2
nd division, who get between 40 and 50 in 3rd division, who get more than 75 in
distinction and who get less than 40 will be failed. Find the number of students who get
(i) 1 st division,
SOLUTION:
> x=seq(0,100,length=100)
> y=dnorm(x,60,12)
> plot(x,y,type="l")
> (pnorm(75,mean=60,sd=12)-
pnorm(60,mean=60,sd=12))*800
[1] 315.4802
> x=seq(60,75,length=100)
> y=dnorm(x,60,12)
> polygon(c(60,x,75),c(0,y,0),col="green")
> (pnorm(50,mean=60,sd=12)-
pnorm(40,mean=60,sd=12))*800
[1] 123.6304
> x=seq(40,50,length=100)
> y=dnorm(x,60,12)
> polygon(c(40,x,50),c(0,y,0),col="yellow")
> (pnorm(40,mean=60,sd=12))*800
[1] 38.23228
> x=seq(0,40,length=100)
> y=dnorm(x,60,12)
> polygon(c(0,x,40),c(0,y,0),col="red")
> text(20,0.005,"Failed")
PROBLEM 4
The distribution of typing mistakes committed by a typist is given below assuming the
distribution to be Poisson, find the expected frequencies.
x 0 1 2 3 4 5
f(x) 42 33 14 6 4 1
Also, check the mean and variance of the Poisson distribution. Plot the Poisson distribution
and compare with binomial distribution.
SOLUTION:
>x<-c(0,1,2,3,4,5)
> f<-c(42,33,14,6,4,1)
> fx=f*x
> fx
[1] 0 33 28 18 16 5
> sum(fx)
[1] 100
> sum(f)
[1] 100
> lambda=sum(fx)/sum(f)
> lambda
[1] 1
> dpois(0,lambda)
[1] 0.3678794
> dpois(1,lambda)
[1] 0.3678794
> dpois(2,lambda)
[1] 0.1839397
> dpois(3,lambda)
[1] 0.06131324
> dpois(4,lambda)
[1] 0.01532831
> dpois(5,lambda)
[1] 0.003065662
> plot(x,dpois(x,1),xlab="x",ylab="dpois(x)",main="POISSON
DISTRIBUTION")
>dbinom(0,15,0.16)
[1] 0.07314578
> dbinom(1,15,0.16)
[1] 0.208988
> dbinom(2,15,0.16)
[1] 0.2786506
> dbinom(3,15,0.16)
[1] 0.2299973
> dbinom(4,15,0.16)
[1] 0.131427
> dbinom(5,15,0.16)
[1] 0.05507419
>plot(x,dbinom(x,size=15,prob=0.16),xlab="x",ylab="dbinom(x
)",main="BINOMIAL DISTRIBUTION")
PROBLEM 5
Suppose the weights of 600 male students are normally distributed with mean 70 kgs with a
standard deviation of 12 kgs. Find the number of students whose weights are (i) 82 kgs, (ii)
between 65 and 88, (iii) greater than 90, and (iv) less than 75 kgs, and also plot the graph
for each event.
SOLUTION :
>A<-seq(1,600,by=1)
> B<-dnorm(A,mean=70,sd=12)
> #(i)weight is 80 kg
> (pnorm(80,mean=70,sd=12))*600
[1] 478.603
> #478 students weigh 80 kg
> (pnorm(88,mean=70,sd=12)-
pnorm(65,mean=70,sd=12))*600
[1] 356.839
> (1-pnorm(90,mean=70,sd=12))*600
[1] 28.67421
> (pnorm(75,mean=70,sd=12))*600
[1] 396.9233