Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #### PREGUNTA N°10
- ## a)
- rm(list = ls())
- Y2=vector()
- U=vector()
- n=100
- for (i in 1:n) {
- U[i]=runif(1,0,1) #Variable de control
- Y2[i]=(exp((U[i]+U[i])^2))
- }
- c=-cov(Y2,U)/var(U)
- p=cor(U,Y2);p
- Var_IC=var(U)*(1-p^2)
- Var_IC
- #### b)antiteticas
- rm(list = ls())
- Y2=vector()
- U=vector()
- n=100
- for (i in 1:n) {
- U[i]=runif(1,0,1)
- Y2[i]=(exp((2*U[i])^2)+(exp((1-2*U[i])^2)))/2
- }
- var(Y2)/n
- #### Pregunta 12
- ## a)
- n <- 10000
- x <- runif(n, -1, 1)
- y <- runif(n, -1, 1)
- indice <- (x+y < 0)
- # Aproximación por simulación
- sum(indice)/n
Add Comment
Please, Sign In to add comment