################################################################## ## R code (R Code Development Team 2004 - www.r-project.org) to ## calculate Information Criterion (IC) weights from text outputs ## derived from 'Interactive Individual Identification Software' ## (I3S),formerly known as 'Individual Raggie Identification ## System' (IRIS). Available from www.reijns.com/i3s. ################################################################## ################################################# ## Code developed by CJA Bradshaw & CW Speed © ## Charles Darwin Universtiy, Darwin, Australia ## Email: corey.bradshaw@cdu.edu.au ## September 2006 ################################################# ############################################################################ ## This code accompanies the manuscript entitled: ## Spot the match – wildlife photo-identification using information theory ## by CW Speed, MG Meekan, CJA Bradshaw ## Frontiers in Zoology ############################################################################ ## Establish target folder containing I3S text outputs (e.g.) folder <- "C:/" ## Establish I3S text output of scores file <- "file.name" ## Calculate Information Criteria and weights target.file <- paste(folder,file,sep="") ## Import data dat <- read.table(target.file,header=F) colnames(dat) <- c("image","spots","score") ## Information Criterion IC <- 2+((100*(1/dat$spots))*log((dat$score*dat$spots^2)/(100*(1/dat$spots)))) IC <- IC[-1] ## delta IC dIC <- IC - min(IC) ## IC weight wIC <- (exp(-0.5*dIC))/sum(exp(-0.5*dIC)) ## Best matching image IC weight best.ICw <- wIC[1] ## Best matching image information-theoretic evidence ratio (ER) best.ER <- wIC[1]/wIC[2] ## Best imate statistics print(paste("best image file name =",dat$image[1])) print(paste("IC weight =",best.ICw)) print(paste("IC evidence ratio =",best.ER))