[R] Scatterplot matrix - Pearson linear correlation and Density Ellipse

ashz ashz at walla.co.il
Mon Oct 4 16:26:38 CEST 2010


Hi,

strangely, when I run this script:

panel.cor = function(x, y, digits=2, prefix="r=", cex.cor)
{
    usr = par("usr"); on.exit(par(usr))
    par(usr = c(0, 1, 0, 1))
    r = abs(cor(x, y, use="pairwise.complete.obs", method = "pearson"))
    txt = format(c(r, 0.123456789), digits=digits)[1]
    txt = paste(prefix, txt, sep="")
    if(missing(cex.cor)) cex.cor = 0.8/strwidth(txt)
    text(0.5, 0.5, txt, cex = cex.cor)
}

 pairs(cap[8:11], lower.panel=panel.lm, upper.panel=panel.cor, cex=2)


I get linear regression and density ellipse, why?

Is it possible to add also the data point?

Thanks a lot

-- 
View this message in context: http://r.789695.n4.nabble.com/Scatterplot-matrix-Pearson-linear-correlation-and-Density-Ellipse-tp2763552p2954416.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list