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(91.25,91.5,91.68,91.81,91.84,91.93,92.08,92.11,92.26,92.28,92.39,92.46,92.82,93.16,93.33,93.51,93.56,93.67,93.76,93.88,94.01,94.21,94.31,94.4,94.9,95.31,95.52,95.68,95.91,95.97,96.15,96.34,96.42,96.54,96.72,96.81,97.19,97.5,97.71,97.86,98.04,98.2,98.25,98.41,98.56,98.62,98.75,98.71,99.05,99.52,99.71,99.8,100.01,99.99,100.12,100.15,100.27,100.42,100.43,100.5,100.95,101.26,101.42,101.68,101.75,101.89,102.07,102.22,102.45,102.62,102.67,102.86,104.78,104.87,105.06,105.14,105.32,105.54,105.68,105.77,106.07,106.03,106.13,106.28,106.61,106.74,107.01,107.1,107.28,107.4,107.59,107.69,107.78) > x <- c(90.49,90.65,90.95,91.19,91.07,91.15,91.81,91.95,91.62,91.27,91.4,91.76,91.99,92.34,92.3,92.85,92.94,93.26,94.21,94.08,93.98,94.23,94.93,95.09,95.37,96.23,96.2,95.43,95.63,95.96,96.51,96.65,96.21,95.54,95.96,96.41,96.32,96.94,96.97,97.63,97.33,97.66,98.18,98.22,97.91,97.93,98.4,98.78,98.73,99.4,99.04,99.68,99.62,99.8,100.65,100.59,100.46,100.57,100.75,100.7,101.44,101.77,101.79,101.52,101.83,102.23,103.04,102.81,102.48,102.81,103.21,103.21,102.92,103.48,103.18,103.39,103.5,103.73,104.42,104.53,104.09,104.23,104.23,104.54,104.65,105.48,105.61,105.74,105.86,105.81,106.49,106.43,105.73) > par7 = 'Y' > par6 = 'Y' > par5 = '0' > par4 = '0' > par3 = '0' > par2 = '50' > par1 = '50' > ylab = 'Huur' > xlab = 'Diensten' > 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/1hv9i1194252295.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 -4.006 1.046 > 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/2atwr1194252295.tab") > > system("convert tmp/1hv9i1194252295.ps tmp/1hv9i1194252295.png") > > > proc.time() user system elapsed 1.569 0.477 1.623