R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(8.4,8.5,8.4,8.5,8.5,8.5,8.6,8.6,8.7,8.8,8.8,8.8,8.8,8.8,8.9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9.1,9.1,9.1,9.1,9.1,9.1,9.1,9,9,9,9,9,9,9,9,9,9,9,8.9,8.8,8.8,8.8,8.8,8.7,8.6,8.5,8.5,8.4,8.3,8.2,8.1,8.1,8,7.9,7.8,7.7,7.5,7.5,7.4,7.3,7.2) > x <- c(6.5,6.4,6.2,6.2,6.3,7.5,7.4,7.4,7.4,7.4,7.4,7.2,7.2,7.2,7.5,7.4,7.4,8,8.1,8.1,8.1,8.1,8.1,7.9,7.9,8,8.1,8.1,8.1,8.5,8.5,8.6,8.4,8.4,8.4,7.7,7.8,7.9,8.7,8.8,8.8,8.5,8.5,8.5,8.4,8.5,8.5,8.3,8.4,8.4,8.4,8.4,8.4,8.5,8.5,8.5,8.5,8.5,8.5,8.3,8.3,8.4,8.2,8.2,8.1,8.1,8,7.8,7.9,7.8,7.7,7.9,7.8) > par7 = 'Y' > par6 = 'Y' > par5 = '0' > par4 = '0' > par3 = '0' > par2 = '50' > par1 = '50' > ylab = 'y: EU 27' > xlab = 'x: België' > main = 'Bivariate Kernel Density' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: WESSA, (2007), Bivariate Kernel Density Estimation (v1.0.5) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_bidensity.wasp/ > #Source of accompanying publication: Lucy, D. Aykroyd, R.G. & Pollard, A.M.(2002) Non-parametric calibration for age estimation. Applied Statistics 51(2): 183-196 > #Technical description: This code makes use of the GenKern package. The dataset is based on http://exploringdata.cqu.edu.au/datasets/chirps.tab : x = temperature (degrees F) and y = chirps per second of crickets (insects). > 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 Loading GenKern version 1.1 Copyright Lucy and Aykroyd 2000 last update October 2004 requires KernSmooth Package GenKern installed > 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/html/rcomp/tmp/1w5l41194301048.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 7.2462 0.1790 > abline(r) > box() > dev.off() null device 1 > load(file='/var/www/html/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/html/rcomp/tmp/2m07m1194301048.tab") > > system("convert tmp/1w5l41194301048.ps tmp/1w5l41194301048.png") > > > proc.time() user system elapsed 0.815 0.280 0.901