[R-SIG-Finance] Bloomberg

Dan Davison davison at stats.ox.ac.uk
Fri Aug 24 13:11:24 CEST 2007


On Thu, Aug 23, 2007 at 10:38:00PM +0200, Thomas Steiner wrote:
> > (1) http://commons.wikimedia.org/wiki/Image:Quantile_graph.png
> > The R code is included at the bottom of the page.
> 
> :) my image :))
> but it's really very "pseudo".

This approach does give a good pure R solution doesn't it? e.g. something like

gradient.under.graph <- function(n=100, y0=0, mu=-0.7, sd=1, nrects=1000) {
    y <- y0 + cumsum(rnorm(n, mean=mu, sd=sd))
    plot(NA, xlim=c(1,n), ylim=range(y), bty="n")
    col <- colorRampPalette(colors=c("dark blue","light blue"))(nrects)
    incr <- (max(y) - min(y)) / nrects
    rect(0, seq(min(y), max(y)-incr, length=nrects), n, seq(min(y)+incr, max(y), length=nrects), col=col, border=NA)
    polygon(x=c(1,1:n,n), y=c(max(y), y, max(y)), col="white", border=NULL)
}

is not slow.

Dan




> Thomas
> 
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. 
> -- If you want to post, subscribe first.



More information about the R-SIG-Finance mailing list