1. Install the RGL package, EVD package, and mass package:
> Install. packages ("RGL") Installing package (s) into 'd:/Program/R/Library (as 'lib' is unspecified) Try to open URL 'HTTP: // encoding type 'application/zip' length 1937097 bytes (1.8 MB) enabled urldownloaded 1.8 mbpackage 'rgl 'successfully unpacked and MD5 sums checkedthe downloaded Binary packages are in C: \ Users \ liqiang \ appdata \ Local \ temp \ rtmpijwxp2 \ downloaded_packages> install. packages ("EVD") Installing package (s) into 'd:/Program/R/Library (as 'lib' is unspecified) Try to open URL 'HTTP: // specify type 'application/zip' length 1176009 bytes (1.1 MB) Enable urldownloaded 1.1 mbpackage 'evd' successfully unpacked and MD5 sums checkedthe downloaded Binary packages are in C: \ Users \ liqiang \ appdata \ Local \ temp \ rtmpijwxp2 \ downloaded_packages> install. packages ("mass") Installing package (s) into 'd:/Program/R/Library (as 'lib' is unspecified) Try to open URL 'HTTP: // encoding type 'application/zip' length 872270 bytes (851 KB) enabled urldownloaded 851 kbpackage 'mass' successfully unpacked and MD5 sums checkedthe downloaded Binary packages are in C: \ Users \ liqiang \ appdata \ Local \ temp \ rtmpijwxp2 \ downloaded_packages
2. Input Program
library(rgl)library(MASS)library(evd);data(lossalae)U=rand(lossalae[,1]+rnorm(nrow(lossalae),mean=0,sd=.001))/(nrow(lossalae)+1)V=rank(lossalae[,2])/(nrow(lossalae)+1)M=kde2d(qnorm(U), qnorm(V), n=35)persp3d(M$x, M$y, M$z, col='green',xlab="loss", ylab="alae", zlab="")
3. Output 3D images