| 1 | back to first page[..][[BR]] |
| 2 | |
| 3 | * Distribution conjointe (histogramme et corrélation entre deux variables) |
| 4 | http://freakonometrics.blog.free.fr/index.php?tag/R |
| 5 | {{{ |
| 6 | library(evd); data(lossalae) |
| 7 | x <- lossalae$Loss; y <- lossalae$ALAE |
| 8 | xhist <- hist(log(x), plot=FALSE) |
| 9 | yhist <- hist(log(y), plot=FALSE) |
| 10 | top <- max(c(xhist$counts, yhist$counts)) |
| 11 | nf <- layout(matrix(c(2,0,1,3),2,2,byrow=TRUE), |
| 12 | c(3,1), c(1,3), TRUE) |
| 13 | par(mar=c(3,3,1,1)) |
| 14 | plot(x, y, xlab="", ylab="",log="xy",col="red") |
| 15 | par(mar=c(0,3,1,1)) |
| 16 | barplot(xhist$counts, axes=FALSE, ylim=c(0, top), |
| 17 | space=0,col="light green") |
| 18 | par(mar=c(3,0,1,1)) |
| 19 | barplot(yhist$counts, axes=FALSE, xlim=c(0, top), |
| 20 | space=0, horiz=TRUE,col="light blue") |
| 21 | }}} |
| 22 | |