TALLERES EN R - RESPUESTAS


Aclaración: Este taller lo hicimos con ayuda del monitor, le agradeceos por eso.


TALLER 311


Problema 7

fx <- function(x){ifelse(x >= 1 & x <= 3, 1/2, 0)} # f(x) 

(1) Area bajo la curva

integrate(fx, lower = 1, upper = 3)$value 
## [1] 1

(2) Probabilidades (Bajo la densidad)

integrate(fx, lower = 2, upper = 2.5)$value   # P(2<X<2.5)
## [1] 0.25
0                                            # P(X=2.5)
## [1] 0
integrate(fx, lower = 2, upper = 2.5)$value   # P(2≤X<2.5)
## [1] 0.25
integrate(fx, lower = 2.5, upper = 3)$value   # P(X>2.5)
## [1] 0.25
integrate(fx, lower = 2.5, upper = 3)$value   # P(X≥2.5)
## [1] 0.25

(3) Probabilidades (Bajo acumulada)

Fx <- function(x){ifelse(x < 1, 0,
                  ifelse(x <= 3, (x - 1)/2, 1))}

Fx(2.5) - Fx(2)
## [1] 0.25
0
## [1] 0
Fx(2.5) - Fx(2)
## [1] 0.25
Fx(3) - Fx(2.5)
## [1] 0.25
Fx(3) - Fx(2.5)
## [1] 0.25