minfconf=function(x,y){ #this will spit out the quantiles of the MI from the bootstrap.. library(sm) air3 <- cbind(x,y) result.12 <- sm.density(air3, eval.points = air3, display = "none") result.1 <- sm.density(x, eval.points = x, display = "none") result.2 <- sm.density(y, eval.points = y, display = "none") tobs <- mean(log(result.12$estimate / (result.1$estimate * result.2$estimate))) print(c(tobs)) n=length(x) nsim <- 500 #500 bootstrap samples.. simval <- rep(0,nsim) for (i in 1:nsim) { xx=1:n xy=sample(xx,replace=TRUE) samp <- cbind(y1 = x, y2 = y[xy]) # samp <- cbind(y1 = x[xy], y2 = y[xy]) result.12 <- sm.density(samp, eval.points = samp, display = "none") result.1 <- sm.density(samp[,1], eval.points = samp[,1], display = "none") result.2 <- sm.density(samp[,2], eval.points = samp[,2], display = "none") simval[i] <- mean(log(result.12$estimate / (result.1$estimate * result.2$estimate))) } quantile(simval,c(0.05,0.1,.50,.90,.95)) }