# Soluz Lab 1 IS 2025 # Esercizio 1. # a) dbinom(3,size=5,prob=0.3) # 0.1323 # b) pbinom(3,size=10,prob=0.3) # 0.6496 # c) qbinom(0.95,size=100,prob=0.3) # 38 # d) sum(dbinom(3:5,size=10,prob=0.3)) # 0.5698682 # e) rbinom(20,size=10,prob=0.3) # Esercizio 2. xx=seq(0,15,1) yy=dpois(xx,3) plot(xx,yy,type="h",lwd=2) # per la binomiale x=0:10 y=dbinom(0:10,10,0.3) plot(x,y,type="p",pch=16,lwd=2) plot(x,y,type="h",lwd=2) title("") # Esercizio 3. # a) curve(dnorm(x,-4,sqrt(1)),from=-10,to=12) curve(dnorm(x,7,sqrt(1)), add=T, lty=2) # b) aa=rnorm(1000,0,1) hist(aa,prob=T) curve(dnorm(x,0,1), add=T) # Esercizio 4. curve(dexp(x,rate=1/0.5),from=0,to=5) curve(dexp(x,rate=1),add=T,lty=2) curve(dexp(x,rate=1/2),add=T,lty=3) # Esercizio 5. curve(dgamma(x,shape=1,scale=2),from=0,to=10) curve(dgamma(x,shape=2,scale=2),add=T,lty=2) curve(dgamma(x,shape=3,scale=2),add=T,lty=3) curve(dgamma(x,shape=5,scale=1),add=T,lty=4) # Esercizio 6. curve(dnorm(x),from=-3,to=3) pnorm(-1) # Esercizio 7. pnorm(3,1,sqrt(2))-pnorm(-2,1,sqrt(2)) # 0.904