Distribución Binomial

x<-seq(0, 10, 1)
pdf_binom<-dbinom(x, 10, 0.3)
tabla<-data.frame(x, pdf_binom)
names(tabla)<-c("Variable Aleatoria", "Probabilidad")
tabla
##    Variable Aleatoria Probabilidad
## 1                   0 0.0282475249
## 2                   1 0.1210608210
## 3                   2 0.2334744405
## 4                   3 0.2668279320
## 5                   4 0.2001209490
## 6                   5 0.1029193452
## 7                   6 0.0367569090
## 8                   7 0.0090016920
## 9                   8 0.0014467005
## 10                  9 0.0001377810
## 11                 10 0.0000059049

Grafica de PDF

barplot(pdf_binom, main="Binomial", 
        xlab="Variable Aleatoria",
        ylab="Densidad",
        col="Red",
        ylim=c(0,0.3))

## CDF

cdf_binom<-pbinom(x, 10, 0.3)
cdf_tabla<-data.frame(x, cdf_binom)
names(cdf_tabla)<-c("Variable Aleatoria", "Acumulado")
cdf_tabla
##    Variable Aleatoria  Acumulado
## 1                   0 0.02824752
## 2                   1 0.14930835
## 3                   2 0.38278279
## 4                   3 0.64961072
## 5                   4 0.84973167
## 6                   5 0.95265101
## 7                   6 0.98940792
## 8                   7 0.99840961
## 9                   8 0.99985631
## 10                  9 0.99999410
## 11                 10 1.00000000
plot(x, cdf_binom, main="Acumulada", 
     xlab="Variable Aleatoria",
     ylab="Probabilidad",
     type="b",
     lwd="3",
     col="blue")

# Distribución Nomral

y<-seq(10,90,0.1)
normal<-dnorm(y, mean(y), 9)
plot(y, normal, main="Distribucion Nomral",
     xlab="Variable Aleatoria",
     ylab="Densidad",
     lwd=4,
     type="l")

## Función para Calculo de Probabilidad

#Calculo de Área
cdf_normal<-function(Z1, Z2){
  A1<-pnorm(Z1, mean(y), 9)
  A2<-pnorm(Z2, mean(y), 9)
  A2-A1
}
cdf_normal(40,60)
## [1] 0.7334795

\(P(40 \leq x \leq 60)=\) 0.7334795