R version 2.6.2 (2008-02-08) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > z <- c(69,90,62,72,86,69,64,72,86) > y <- c(25,30,35,25,30,35,25,30,35) > x <- c(25,25,25,150,150,150,250,250,250) > par7 = 'Numberof Courses' > par6 = 'Age of Workers' > par5 = 'Size of Firm' > par4 = 'Y' > par3 = 'Y' > par2 = '10' > par1 = '10' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > 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) Loading required package: KernSmooth KernSmooth 2.22 installed Copyright M. P. Wand 1997 Loading GenKern version 1.1 Copyright Lucy and Aykroyd 2000 last update October 2004 requires KernSmooth Package GenKern installed > 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/1hu1d1210867438.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() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2g80q1210867438.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() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3n5wv1210867438.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() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4zxkc1210867438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pairs(d,diag.panel=panel.hist) > dev.off() null device 1 > x <- as.vector(x) > y <- as.vector(y) > z <- as.vector(z) > postscript(file="/var/www/html/rcomp/tmp/5vz4r1210867438.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)) Call: lm(formula = y ~ x) Coefficients: (Intercept) x 3.000e+01 7.813e-18 > abline(r) > box() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6oqxd1210867438.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 $xords [1] 20.34205 22.48826 24.63447 26.78068 28.92689 31.07311 33.21932 35.36553 [9] 37.51174 39.65795 $yords [1] 54.14034 58.99804 63.85574 68.71345 73.57115 78.42885 83.28655 88.14426 [9] 93.00196 97.85966 $zden [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.002373467 0.008892224 0.01750405 0.01970531 0.012160880 0.003832159 [2,] 0.004253090 0.017482981 0.03730381 0.04536775 0.030599842 0.011102875 [3,] 0.004738129 0.021392147 0.05000988 0.06654126 0.049521050 0.021507110 [4,] 0.003635404 0.017234357 0.04437117 0.06616324 0.055417638 0.030097730 [5,] 0.003308723 0.012634780 0.03170692 0.05181255 0.048924096 0.033254153 [6,] 0.005462238 0.015769253 0.02942476 0.04194578 0.039634127 0.030956404 [7,] 0.008172617 0.023382598 0.03725773 0.04134922 0.032544226 0.025353639 [8,] 0.007905499 0.024399450 0.03915027 0.03945206 0.026367007 0.018295233 [9,] 0.004711936 0.015947278 0.02711944 0.02756324 0.017614473 0.010670567 [10,] 0.001720818 0.006416177 0.01174028 0.01249090 0.008185997 0.004487091 [,7] [,8] [,9] [,10] [1,] 0.0008458028 0.0003505466 0.0001402312 2.757932e-05 [2,] 0.0037588786 0.0023827106 0.0010955246 2.389398e-04 [3,] 0.0118750543 0.0101958445 0.0052580770 1.268274e-03 [4,] 0.0260813477 0.0273123325 0.0155438346 4.130470e-03 [5,] 0.0394636574 0.0464508551 0.0285947240 8.294391e-03 [6,] 0.0431617245 0.0529278346 0.0338184936 1.043504e-02 [7,] 0.0380069847 0.0454399541 0.0279975632 8.627163e-03 [8,] 0.0283920337 0.0330450679 0.0186848385 5.244186e-03 [9,] 0.0164095293 0.0196485509 0.0107219927 2.696729e-03 [10,] 0.0064996058 0.0083313366 0.0047527161 1.171313e-03 > 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)) Call: lm(formula = z ~ y) Coefficients: (Intercept) y 62.44 0.40 > abline(r) > box() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/7ghf41210867438.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 $xords [1] -73.16778 -26.35272 20.46234 67.27741 114.09247 160.90753 207.72259 [8] 254.53766 301.35272 348.16778 $yords [1] 54.14034 58.99804 63.85574 68.71345 73.57115 78.42885 83.28655 88.14426 [9] 93.00196 97.85966 $zden [,1] [,2] [,3] [,4] [,5] [1,] 1.355424e-04 0.0003913127 0.0005944187 0.0005441652 0.0002910823 [2,] 3.008165e-04 0.0008817502 0.0013651485 0.0012810622 0.0007065626 [3,] 4.026590e-04 0.0012125743 0.0019679848 0.0019758288 0.0011787229 [4,] 3.332582e-04 0.0010757924 0.0019917973 0.0023622570 0.0016514956 [5,] 1.979569e-04 0.0007634757 0.0018199398 0.0027018192 0.0022203919 [6,] 1.508920e-04 0.0006904155 0.0018596307 0.0029743709 0.0026106913 [7,] 1.906079e-04 0.0008316063 0.0019765207 0.0028740759 0.0025012701 [8,] 2.074115e-04 0.0008536738 0.0017970444 0.0023231294 0.0019605307 [9,] 1.452685e-04 0.0005872982 0.0011738038 0.0014220080 0.0011757062 [10,] 6.199816e-05 0.0002510121 0.0004950416 0.0005858702 0.0004811299 [,6] [,7] [,8] [,9] [,10] [1,] 0.0001120099 0.0001845949 0.0003619384 0.0003163458 1.174413e-04 [2,] 0.0002787412 0.0004350487 0.0008367125 0.0007311050 2.732537e-04 [3,] 0.0005062345 0.0007070935 0.0012442663 0.0010489818 3.876588e-04 [4,] 0.0008273585 0.0009801234 0.0013867238 0.0010236134 3.521267e-04 [5,] 0.0012677538 0.0013401618 0.0014778206 0.0008532149 2.403650e-04 [6,] 0.0016015727 0.0016547274 0.0016155844 0.0007711222 1.690202e-04 [7,] 0.0016151838 0.0017167017 0.0016322379 0.0007316516 1.423227e-04 [8,] 0.0013185564 0.0014531915 0.0013866230 0.0006173807 1.175867e-04 [9,] 0.0008084994 0.0009091161 0.0008754236 0.0003927227 7.521609e-05 [10,] 0.0003334225 0.0003768957 0.0003664120 0.0001662127 3.218846e-05 > 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)) Call: lm(formula = z ~ x) Coefficients: (Intercept) x 74.150273 0.002077 > abline(r) > box() > dev.off() null device 1 > > system("convert tmp/1hu1d1210867438.ps tmp/1hu1d1210867438.png") > system("convert tmp/2g80q1210867438.ps tmp/2g80q1210867438.png") > system("convert tmp/3n5wv1210867438.ps tmp/3n5wv1210867438.png") > system("convert tmp/4zxkc1210867438.ps tmp/4zxkc1210867438.png") > system("convert tmp/5vz4r1210867438.ps tmp/5vz4r1210867438.png") > system("convert tmp/6oqxd1210867438.ps tmp/6oqxd1210867438.png") > system("convert tmp/7ghf41210867438.ps tmp/7ghf41210867438.png") > > > proc.time() user system elapsed 3.657 1.843 3.950