You are on page 1of 4

SL-1(PRACTICAL no-2)

HARSHITA GUPTA
86032200058
D017

#Q1

n=10

p=0.5

#p(x>=7)=p(x=7)+p(x=8)+.....+p(x+10)

#to get more than one type of prob

x=dbinom(7,10,0.5)+dbinom(8,10,0.5)+dbinom(9,10,0.5)+dbinom(10,10,0.5)

#pbinom to find less than type of prob

#another method

#p

x=1-pbinom(6,n,p)

> #Q1

> n=10

> p=0.5

> #p(x>=7)=p(x=7)+p(x=8)+.....+p(x+10)

> #to get more than one type of prob

> x=dbinom(7,10,0.5)+dbinom(8,10,0.5)+dbinom(9,10,0.5)+dbinom(10,10,0.5)

>x

[1] 0.171875

> #pbinom to find less than type of prob

> #another method

> #p
> x=1-pbinom(6,n,p)

>x

[1] 0.171875

#q2

n=5

p=3/5

x=1-pbinom(2,n,p)

x> #q2

> n=5

> p=3/5

> x=1-pbinom(2,n,p)

>x

[1] 0.68256

#q3

mean=16

var=8

q=1/2

p=1/2

n=32

x=dbinom(0,32,1/2)

x=dbinom(1,32,1/2)

x=dbinom(2,32,1/2)

#q3

> mean=16

> var=8

> q=1/2

> p=1/2

> n=32
> x=dbinom(0,32,1/2)

>x

[1] 2.328306e-10

> x=dbinom(1,32,1/2)

>x

[1] 7.450581e-09

> x=dbinom(2,32,1/2)

>x

[1] 1.15484e-07

#q4

#for normal we have dnorm

#pnorm for less thgan equal to

#for greater than 1-pnorm or pnorm(x,n,p,false)

n=30

p=4

pnorm(40,30,4)

z=pnorm(21,30,4,FALSE)

pnorm(35,30,4)-pnorm(30,30,4) > #q4

> #for normal we have dnorm

> #pnorm for less thgan equal to

> #for greater than 1-pnorm or pnorm(x,n,p,false)

> n=30

> p=4

> pnorm(40,30,4)

[1] 0.9937903

> z=pnorm(21,30,4,FALSE)

>z

[1] 0.9877755

> pnorm(35,30,4)-pnorm(30,30,4)

[1] 0.3943502

You might also like