set.seed(36)
library(flextable)
library(dplyr)
## 
## Adjuntando el paquete: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(MASS)
## 
## Adjuntando el paquete: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
library(ggplot2)

PUNTO 1

e <- 27
g <- 3

sol.1 <- e*(e-1)*(e-2)/(3*2*1)   
cat("numero de grupos de 3 =", sol.1)
## numero de grupos de 3 = 2925

PUNTO 2

pL <- 0.75
pS <- 0.25
pR.L <- 0.60
pR.S <- 0.30

pL.R <- (pR.L * pL) / ((pR.L * pL) + (pR.S * pS))
pL.R
## [1] 0.8571429
pL.R <- pL * pR.L         
pL.noR <- pL * (1 - pR.L)  
pS.R <- pS * pR.S          
pS.noR <- pS * (1 - pR.S)  

Punto 3

f.x <- function(x){(3/2)*sqrt(x)}

sol.a <- integrate(f.x, lower = 0, upper = 1)$value
sol.a
## [1] 1
sol.b <- integrate(f.x, lower = 0.2, upper = 0.5)$value
sol.b
## [1] 0.2641107
E.x <- function(x){x*(3/2)*sqrt(x)}
sol.c <- integrate(E.x, lower = 0, upper = 1)$value
sol.c
## [1] 0.6

grafica

library(ggplot2)

x. <- seq(0,1,by = 0.001)

y. <- sapply(x., f.x)

df <- data.frame(x.,y.)

ggplot(df, aes(x = x., y = y.)) +
  geom_line(color = "red", size = 1.4) +
  labs(title = "Funcion de densidad f(x)",
     x = "x", y = "f(x)")+
  theme_bw(base_size = 10)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

Punto 4

n <- 5
p <- 0.4

dbinom(4, n, p) + dbinom(5, n, p)
## [1] 0.08704

punto 5

media <- 20         
desviacion <- 4    


a <- pnorm(26, mean = media, sd = desviacion) - pnorm(18, mean = media, sd = desviacion)


b <- pnorm(10, mean = media, sd = desviacion)


c <- 1 - pnorm(20, mean = media, sd = desviacion)

cat("sol.a) P(18 <= X <= 26) =", sol.a)
## sol.a) P(18 <= X <= 26) = 1
cat("sol.b) P(X < 10)      =", sol.b)
## sol.b) P(X < 10)      = 0.2641107
cat("sol.c) P(X > 20)      =", sol.c)
## sol.c) P(X > 20)      = 0.6