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(9041.46,9476.91,9420.10,9690.65,10084.25,10344.12,10086.71,9959.87,10256.23,10172.04,10258.34,10703.35,11484.51,11568.05,10991.80,10545.34,11462.71,11462.40,11285.57,11552.26,12171.38,12174.88,12531.67,13099.33,13331.94,13021.59,13040.64,13030.09,12362.41,12602.89,12794.66,12874.90,13015.84,13495.45,14123.82,14246.00,13652.94,13616.55,13934.98,13773.79,13585.12,13810.92,13657.18,14075.57,14663.08,15107.66,15358.34,16375.51,17602.60,17824.63,17892.97,19639.74,21790.73,19187.52,20357.82,20291.34,19264.86,18858.49,20156.19,20222.50,20251.14,21373.38,21091.86,21856.72,21532.48,21085.27,21388.73,21363.38,22842.24,24231.43) > x <- c(18.33,22.6,24.9,24.8,23.8,25.1,26,27.4,27.3,24.3,28.4,24.4,30.3,31.5,29.8,25.3,25.6,26.7,27.4,28.6,26.3,28.5,28.4,29.4,30.3,29.6,32.1,32.4,36.3,34.6,36.3,40.3,40.4,45.4,39,35.7,40.2,41.7,49.1,49.6,47,52,53.1,57.8,57.9,54.6,51.3,52.7,58.5,56.6,57.9,64.4,65.1,64.6,68.9,68.8,59.3,55,55.4,58,50.8,54.6,58.6,63.6,64.5,66.9,71.9,68.7,74.2,75.8) > par7 = 'Y' > par6 = 'Y' > par5 = '0' > par4 = '0' > par3 = '0' > par2 = '50' > par1 = '50' > ylab = 'goudprijs' > xlab = 'olieprijs' > 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/1eerf1197034484.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 4391.3 239.5 > 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/2celj1197034484.tab") > > system("convert tmp/1eerf1197034484.ps tmp/1eerf1197034484.png") > > > proc.time() user system elapsed 0.825 0.272 0.884