vc pode fazer assim: SMR2 <- function(a,w=1) sum(w*a$Hosp_Death)/sum(w*a$SAPS3Pro2) SMR2(a) ### SMR observada nos dados require(boot) plot(boo <- boot(a,SMR2,999,stype='i')) boot.ci(boo)