Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- matriz <- matrix(rnorm(5000,mean=100,sd=25), 50, 100)
- pob_prom = mean(matriz)
- data <- as.data.frame(matriz)
- results <- lapply(data,function(p) t.test(p,conf.level = 0.995))
- contar <- lapply(results, function(p) if (p$conf.int[1] <= pob_prom && pob_prom <= p$conf.int[2]) {1} else {0})
- suma <- Reduce("+", contar)
- upper <- lapply(results, function(p) {p$conf.int[2]})
- lower <- lapply(results, function(p) {p$conf.int[1]})
- med <- lapply(results, function(p) {p$estimate})
- med <- as.numeric(med)
- upper <- as.numeric(upper)
- lower <- as.numeric(lower)
- require(plotrix)
- plotCI(1:100, med, ui=upper, li=lower)
- abline(h=pob_prom, col="purple")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement