R version 2.8.1 (2008-12-22) 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. 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. > y <- c(2.653241965,2.602689685,2.4765384,2.681021529,2.747270914,2.646174797,2.701361213,2.653241965,2.681021529,2.844909384,2.734367509,2.660259537,2.862200881,2.674148649,2.667228207,2.809402695,2.815408719,2.809402695,2.827313622,2.753660712,2.797281335,2.912350665,2.827313622,2.803360381,2.90690106,2.714694744,2.753660712,2.895911938,2.821378886,2.939161922,2.944438979,2.895911938,2.879198457,3.068052935,2.839078464,2.928523524,2.944438979,2.797281335,2.827313622,2.923161581,2.960105096,2.965273066,2.867898902,2.923161581,2.895911938,3.015534901,2.895911938,2.975529566,2.990719732,2.954910279,2.879198457,2.954910279,3.091042453,3.04927304,2.970414466,3.100092289,3.039749159,3.100092289,3.157000421,3.068052935,3.19047635,3.126760536,3.010620886,3.165475048,3.148453361,2.975529566,2.890371758,2.850706502,2.821378886,2.901421594,2.803360381,2.772588722,2.912350665) > x <- c(2.740840024,2.714694744,2.459588842,2.791165108,2.815408719,2.708050201,2.701361213,2.681021529,2.727852828,2.884800713,2.797281335,2.734367509,2.884800713,2.766319109,2.63188884,2.879198457,2.884800713,2.856470206,2.815408719,2.772588722,2.809402695,2.949688335,2.879198457,2.844909384,2.923161581,2.791165108,2.714694744,2.954910279,2.87356464,2.949688335,2.890371758,2.862200881,2.879198457,3.04927304,2.844909384,2.965273066,2.985681938,2.867898902,2.785011242,2.970414466,2.990719732,2.995732274,2.850706502,2.939161922,2.923161581,3.063390922,2.923161581,2.985681938,3.034952987,2.975529566,2.87356464,2.985681938,3.100092289,3.0301337,2.884800713,3.039749159,3.054001182,3.063390922,3.135494216,3.058707073,3.173878459,3.109060959,2.90690106,3.126760536,3.104586678,2.879198457,2.797281335,2.772588722,2.797281335,2.87356464,2.809402695,2.785011242,2.90690106) > par7 = 'Y' > par6 = 'Y' > par5 = '0' > par4 = '0' > par3 = '0' > par2 = '50' > par1 = '50' > ylab = 'y' > xlab = 'x' > main = 'Bivariate Kernel Density' > #'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!) > par1 <- as(par1,'numeric') > par2 <- as(par2,'numeric') > par3 <- as(par3,'numeric') > par4 <- as(par4,'numeric') > par5 <- as(par5,'numeric') > library('GenKern') Loading required package: KernSmooth KernSmooth 2.22 installed Copyright M. P. Wand 1997 > if (par3==0) par3 <- dpik(x) > if (par4==0) par4 <- dpik(y) > if (par5==0) par5 <- cor(x,y) > if (par1 > 500) par1 <- 500 > if (par2 > 500) par2 <- 500 > postscript(file="/var/www/rcomp/tmp/1hmn91256643263.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- KernSur(x,y, xgridsize=par1, ygridsize=par2, correlation=par5, xbandwidth=par3, ybandwidth=par4) > image(op$xords, op$yords, op$zden, col=terrain.colors(100), axes=TRUE,main=main,xlab=xlab,ylab=ylab) > if (par6=='Y') contour(op$xords, op$yords, op$zden, add=TRUE) > if (par7=='Y') points(x,y) > (r<-lm(y ~ x)) Call: lm(formula = y ~ x) Coefficients: (Intercept) x -0.1859 1.0603 > abline(r) > box() > dev.off() null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Bandwidth',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'x axis',header=TRUE) > a<-table.element(a,par3) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'y axis',header=TRUE) > a<-table.element(a,par4) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Correlation',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'correlation used in KDE',header=TRUE) > a<-table.element(a,par5) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'correlation(x,y)',header=TRUE) > a<-table.element(a,cor(x,y)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/26yl61256643263.tab") > > system("convert tmp/1hmn91256643263.ps tmp/1hmn91256643263.png") > > > proc.time() user system elapsed 0.570 0.340 0.886