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(101.30,97.60,96.40,97.00,96.40,94.70,89.30,85.90,83.30,81.50,85.00,84.80,87.50,89.00,90.00,89.60,87.40,84.80,81.90,81.10,79.10,80.50,88.50,90.90,84.90,80.00,76.50,75.40,73.50,74.30,77.70,77.90,76.70,77.20,86.00,86.90,92.00,101.70,104.50,101.70,100.60,100.30,102.50,101.00,108.60,103.40,106.40,106.60,108.90,110.50,114.00,112.80,109.60,116.00,124.60,129.00,131.50,138.60,138.10,146.30,157.60,158.40,176.30,199.90,210.40,202.60,207.10,202.00,203.40,216.30,207.30,203.50,204.40,203.70,205.70,208.00,209.30,208.70,206.50,204.50) > x <- c(100.70,97.90,96.50,96.60,96.60,95.50,91.80,89.30,87.00,85.90,88.00,87.90,89.20,90.90,91.60,90.20,89.10,87.50,86.30,86.00,84.40,86.10,91.00,92.70,88.00,84.30,82.20,80.80,79.40,80.20,82.20,82.20,81.20,82.10,88.10,88.50,92.10,98.60,100.90,100.60,101.10,102.10,103.60,102.80,108.30,104.00,106.10,106.30,109.00,111.00,113.70,112.70,110.30,114.50,119.30,121.80,125.40,129.70,129.40,134.50,141.20,141.40,152.20,167.70,173.30,168.70,172.60,169.80,172.00,179.40,174.60,172.50,172.60,176.30,178.90,179.60,179.90,180.30,180.90,177.70) > par7 = 'Y' > par6 = 'Y' > par5 = '0' > par4 = '0' > par3 = '0' > par2 = '50' > par1 = '50' > ylab = 'Totaal metaalproductie' > xlab = 'Productie Non-ferro' > 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/1pswf1194276723.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 -38.414 1.389 > 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/2mi8y1194276723.tab") > > system("convert tmp/1pswf1194276723.ps tmp/1pswf1194276723.png") > > > proc.time() user system elapsed 0.806 0.266 0.874