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(58.4,56.8,69.4,59.6,63.6,68.4,55.9,59.1,66.2,66.5,64.5,74.5,60,61.4,70.1,65.7,67.1,70.8,61.5,60.1,70.1,73.2,67.1,77.4,66.9,66,74,75.8,72.2,78.2,71.4,66.3,79.9,81.2,72.2,88.4,72.2,73,83.8,79.7,79.1,84.3,76.8,69.3,81.3,80.9,76,90,72.6,73.9,91.2,83.1,80.1,91.1,80.1,76.3,93.2,91.6,88.5,103.2,84.9,89,106.9,91.4,99.6,100.6,88,89.7,106.7,106,104.4,123.7,97.1,95.5,112.2,101.4,106.9,109.5,96.4,93.9,104.2,109.2,108.9,117.9,98.2,101.4,111.6,113.6,110.8,113.9,105.5,95.9,115.8,119.9,107.3,126.9,107.8,105.5,120.2,116,110.4,120.8,110.7,99.9,126.8,128.6,112.9,136.6,113.3,116.3,137.5,126.7,118.5,136.4,120.2,117.2,133.3,134.8,129.9,149.5,118.5,122.8,145.7,133.6,130.8,146.8,126,124.4,145.5,146.3,145,162,132.2,140.2,164.8,143.7,144.2,156.4,135.9,134.2,156.5,154.8,155.2,159.5,151.5,150.1,170.6,150.8,156.8,168.8,150.9) > x <- c(70.9,73,83.9,73.2,76.7,83.1,59.8,68.2,91.1,85,81.6,78.8,73,74.3,81.2,79.9,79.7,83.6,68.6,66.6,83.5,91.8,80.5,84.7,78.7,78.4,83.1,84.8,80.7,91.8,75.3,71.8,93,94.3,83.7,95.6,82.2,83.4,93.1,88.7,84.5,95,76.6,73.4,93,91,85.3,89.5,76.1,76.1,91.5,85.4,80,94,72.6,80.8,94.1,94.9,91.9,99.2,84.7,93.7,106.7,93.5,104.8,103.5,83.1,89.6,105.7,110.7,110.4,109,106,100.9,114.3,101.2,109.2,111.6,91.7,93.7,105.7,109.5,105.3,102.8,100.6,97.6,110.3,107.2,107.2,108.1,97.1,92.2,112.2,111.6,115.7,111.3,104.2,103.2,112.7,106.4,102.6,110.6,95.2,89,112.5,116.8,107.2,113.6,101.8,102.6,122.7,110.3,110.5,121.6,100.3,100.7,123.4,127.1,124.1,131.2,111.6,114.2,130.1,125.9,119,133.8,107.5,113.5,134.4,126.8,135.6,139.9,129.8,131,153.1,134.1,144.1,155.9,123.3,128.1,144.3,153,149.9,150.9,141,138.9,157.4,142.7,151.5,160.8,138.4) > 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: 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/1b5uu1194212461.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 -29.244 1.291 > 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/2ervn1194212462.tab") > > system("convert tmp/1b5uu1194212461.ps tmp/1b5uu1194212461.png") > > > proc.time() user system elapsed 0.859 0.275 0.951