z <- c(87,75,74,91,101,103,106,102,105,105,100,95,96,98,99,92,84,81,72,89,96,91,88,90,98,87,100,100,104,107,105,102,98,106,97,101,100,93,94,96,96,98,102,95,85,84,82,87,77,90,90,94,97,96,93,93,93,97,100,95,97,103,102,93,99,100,97,104,102,103,100,90,90)
y <- c(96,86,82,92,99,101,102,100,101,100,99,97,97,97,96,92,91,87,82,89,91,90,87,89,95,85,94,94,97,99,97,96,94,100,96,98,98,94,93,94,94,97,98,95,89,89,89,90,86,92,91,95,99,98,95,96,94,98,98,98,98,102,101,92,99,101,99,102,102,101,99,98,98)
x <- c(513,503,471,471,476,475,470,461,455,456,517,525,523,519,509,512,519,517,510,509,501,507,569,580,578,565,547,555,562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542)
par7 = 'Vooruitzichten'
par6 = 'Cons vertrouwen'
par5 = 'Totaal werkloos'
par4 = 'Y'
par3 = 'Y'
par2 = '50'
par1 = '50'
#'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
#Author: Prof. Dr. P. Wessa
#To cite this work: Wessa P., (2007), 3-Dimensional Scatterplots (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_cloud.wasp/
#Source of accompanying publication: Office for Research, Development, and Education
#Technical description: Write here your technical program description
x <- array(x,dim=c(length(x),1))
colnames(x) <- par5
y <- array(y,dim=c(length(y),1))
colnames(y) <- par6
z <- array(z,dim=c(length(z),1))
colnames(z) <- par7
d <- data.frame(cbind(z,y,x))
colnames(d) <- list(par7,par6,par5)
par1 <- as.numeric(par1)
par2 <- as.numeric(par2)
if (par1>500) par1 <- 500
if (par2>500) par2 <- 500
if (par1<10) par1 <- 10
if (par2<10) par2 <- 10
library(GenKern)
library(lattice)
panel.hist <- function(x, ...)
{
usr <- par('usr'); on.exit(par(usr))
par(usr = c(usr[1:2], 0, 1.5) )
h <- hist(x, plot = FALSE)
breaks <- h$breaks; nB <- length(breaks)
y <- h$counts; y <- y/max(y)
rect(breaks[-nB], 0, breaks[-1], y, col='black', ...)
}
postscript(file="/var/www/html/rcomp/tmp/1wr091199367088.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
cloud(z~x*y, screen = list(x=-45, y=45, z=35),xlab=par5,ylab=par6,zlab=par7)
dev.off()
postscript(file="/var/www/html/rcomp/tmp/20x7u1199367088.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
cloud(z~x*y, screen = list(x=35, y=45, z=25),xlab=par5,ylab=par6,zlab=par7)
dev.off()
postscript(file="/var/www/html/rcomp/tmp/3shsw1199367088.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
cloud(z~x*y, screen = list(x=35, y=-25, z=90),xlab=par5,ylab=par6,zlab=par7)
dev.off()
postscript(file="/var/www/html/rcomp/tmp/4r4qn1199367088.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
pairs(d,diag.panel=panel.hist)
dev.off()
x <- as.vector(x)
y <- as.vector(y)
z <- as.vector(z)
postscript(file="/var/www/html/rcomp/tmp/5eg7e1199367088.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
op <- KernSur(x,y, xgridsize=par1, ygridsize=par2, correlation=cor(x,y), xbandwidth=dpik(x), ybandwidth=dpik(y))
image(op$xords, op$yords, op$zden, col=terrain.colors(100), axes=TRUE,main='Bivariate Kernel Density Plot (x,y)',xlab=par5,ylab=par6)
if (par3=='Y') contour(op$xords, op$yords, op$zden, add=TRUE)
if (par4=='Y') points(x,y)
(r<-lm(y ~ x))
abline(r)
box()
dev.off()
postscript(file="/var/www/html/rcomp/tmp/6446e1199367088.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
op <- KernSur(y,z, xgridsize=par1, ygridsize=par2, correlation=cor(y,z), xbandwidth=dpik(y), ybandwidth=dpik(z))
op
image(op$xords, op$yords, op$zden, col=terrain.colors(100), axes=TRUE,main='Bivariate Kernel Density Plot (y,z)',xlab=par6,ylab=par7)
if (par3=='Y') contour(op$xords, op$yords, op$zden, add=TRUE)
if (par4=='Y') points(y,z)
(r<-lm(z ~ y))
abline(r)
box()
dev.off()
postscript(file="/var/www/html/rcomp/tmp/7pp471199367088.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
op <- KernSur(x,z, xgridsize=par1, ygridsize=par2, correlation=cor(x,z), xbandwidth=dpik(x), ybandwidth=dpik(z))
op
image(op$xords, op$yords, op$zden, col=terrain.colors(100), axes=TRUE,main='Bivariate Kernel Density Plot (x,z)',xlab=par5,ylab=par7)
if (par3=='Y') contour(op$xords, op$yords, op$zden, add=TRUE)
if (par4=='Y') points(x,z)
(r<-lm(z ~ x))
abline(r)
box()
dev.off()

system("convert tmp/1wr091199367088.ps tmp/1wr091199367088.png")
system("convert tmp/20x7u1199367088.ps tmp/20x7u1199367088.png")
system("convert tmp/3shsw1199367088.ps tmp/3shsw1199367088.png")
system("convert tmp/4r4qn1199367088.ps tmp/4r4qn1199367088.png")
system("convert tmp/5eg7e1199367088.ps tmp/5eg7e1199367088.png")
system("convert tmp/6446e1199367088.ps tmp/6446e1199367088.png")
system("convert tmp/7pp471199367088.ps tmp/7pp471199367088.png")

