## libraries needed ## sm, mvtnorm, akima ## make sure you have these installed library(sm) # gives the MI using the formulation of Moon et al. (1995) source("http://civil.colorado.edu/~balajir/CVEN5454/R-sessions/sess3/MI/minf.r") # MI confidence interval source("http://civil.colorado.edu/~balajir/CVEN5454/R-sessions/sess3/MI/mi_confs.r") #computes MI based on a Normal PDF for the joint and marginals in the # MI formulation source("http://civil.colorado.edu/~balajir/CVEN5454/R-sessions/sess3/MI/minf_normal.r") #computes the bootstrap confidence interval based on # Normal PDF, boxplots them and shows the MI of the data # based on kernel PDF source("http://civil.colorado.edu/~balajir/CVEN5454/R-sessions/sess3/MI/mi_normal_confs.r") ## Myboxplots source("http://civil.colorado.edu/~balajir/CVEN5454/R-sessions/sess1/myboxplot.r") source("http://civil.colorado.edu/~balajir/CVEN5454/R-sessions/sess1/myboxplot-stats.r") ## read data test=matrix(scan("http://civil.colorado.edu/~balajir/CVEN5454/R-sessions/sess3/MI/after.txt"),ncol=2,byrow=T) x=test[,1] y=test[,2] minf(x,y) #gives the MI using the formulation of Moon et al. (1995) minfconf(x,y) #computes the bootstrap confidence intervals for MI annd correlation minfnormal(x,y) #gives the MI using Normal PDFs - Normal bivariate, and Normal marginal minfnormalconf(x,y) #computes the bootstrap confidence intervals for MI and correlation # using Normal bivariate and Normal marginal PDFS