# Commands that helped generate the results of Section 2.2 of # "The Portfolio Probe User's Manual" # # These commands demonstrate cacheing variance matrices # and then using them -- this is a useful idiom # # This depends on functions listed in 'pprobe_functions01.R' # The data are created in 'pprobe_R_data01.txt' # the 'save' function is specifically R and is not available # in at least some versions of S-PLUS. # If you have S-PLUS, you will probably need to modify this # things to CHANGE, possibly PP_LOC <- ".." # initial setup if(!exists("us.pricemat")) attach(paste(PP_LOC, "us.pricemat.rda", sep="/")) require(BurStFin) # create return matrix us.retmat <- diff(log(us.pricemat)) # cache the variances for(i in 250:700) { JJd <- rownames(us.retmat)[i] JJn <- paste("varshr", JJd, sep=".") assign(JJn, var.shrink.eqcor(us.retmat[seq(to=i, length=250),])) save(list=JJn, file=paste(PP_LOC, "/Varshr/", JJn, ".rda", sep="")) rm(list=JJn) cat("done with", JJd, "\n") } # you can see how this is used in functions like 'pp.date.meanvarutil' # that you can see in action in 'pprobe_R_bounds.txt'