set.seed(356)
Solución
x1 <- 0:3
g1 <- function(x) x^2 + 4
c1 <- 1 / sum(g1(x1))
tablaa1 <- data.frame(x = x1, P = c1 * g1(x1))
x2 <- 0:2
g2 <- function(x) choose(2,x) * choose(3,3-x)
c2 <- 1 / sum(sapply(x2, g2))
tablaa2 <- data.frame(x = x2, P = c2 * sapply(x2, g2))
c1
## [1] 0.03333333
tablaa1
## x P
## 1 0 0.1333333
## 2 1 0.1666667
## 3 2 0.2666667
## 4 3 0.4333333
c2
## [1] 0.1
tablaa2
## x P
## 1 0 0.1
## 2 1 0.6
## 3 2 0.3
Solución
f <- function(x){ 1000/(x+1000)^2 }
p_a <- integrate(f, 200, Inf)$value
p_b <- integrate(f, 80, 120)$value
res <- data.frame(
evento = c("P(X>=200)","P(80<X<120)"),
P = c(p_a, p_b))
res
## evento P
## 1 P(X>=200) 0.83333333
## 2 P(80<X<120) 0.03306878
Solución
int1 <- integrate(function(x) x, lower=0, upper=1)$value
int2 <- integrate(function(x) 2-x, lower=1, upper=1.2)$value
p_a <- int1 + int2
p_b <- integrate(function(x) x, lower=0.5, upper=1)$value
tabla_prob <- data.frame(
funcion_horas = c("P(X<1.2)","P(0.5<X<1)"),
Probabilidad = c(p_a, p_b)
)
tabla_prob
## funcion_horas Probabilidad
## 1 P(X<1.2) 0.680
## 2 P(0.5<X<1) 0.375
Solución
f <- function(x) (2*(x+2))/5
p_a <- integrate(f, 0, 1)$value
p_b <- integrate(f, 1/4, 1/2)$value
tablaa <- data.frame(
funcion = c("P(0<X<1)","P(1/4<X<1/2)"),
resultado = c(p_a, p_b)
)
tablaa
## funcion resultado
## 1 P(0<X<1) 1.0000
## 2 P(1/4<X<1/2) 0.2375
Solución
tabla <- data.frame(t = c(1,3,5,7), p = rep(1/4,4))
p_a <- tabla$p[tabla$t == 5]
p_b <- sum(tabla$p[tabla$t > 3])
p_c <- sum(tabla$p[tabla$t > 1.4 & tabla$t < 6])
p_d <- sum(tabla$p[tabla$t >= 2 & tabla$t <= 5]) / sum(tabla$p[tabla$t >= 2])
res <- data.frame(
funcion = c("P(T=5)","P(T>3)","P(1.4<T<6)","P(T<=5 | T>=2)"),
Probabilidad = c(p_a, p_b, p_c, p_d)
)
res
## funcion Probabilidad
## 1 P(T=5) 0.2500000
## 2 P(T>3) 0.5000000
## 3 P(1.4<T<6) 0.5000000
## 4 P(T<=5 | T>=2) 0.6666667