R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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. > x <- c(182,110,162,155,141,165,101,152,127,128,121,112,142,164,156,161,176,152,155,85,164,155,88,145,122,161,150,132,171,118,96,114,140,139,184,121,139,140,146,148,112,146,126,169,75,83,163,180,181,168,94,114,107,152,186,118,133,90,127,87,121,103,50,134,89,84,163,50,98,96,123,104,122,124,128,123,76,85,121,88,116,137,66,136,159,102,110,104,107,158,126,83,48,97,63,131,93,97,105,88,89,95,70,81,107,84,129,77,134,84,58,69,93,166,40,102,97,75,67,81,146,103,48,63,147,70,64,77,146,103,63,126,41,65,30,35,56,37,30,20,49,8,22,21,23,12,13,16,18,1,12,8,4,4,0,7,0,0,0,0,0,0,0,0) > par1 = '0' > ylab = 'Density' > xlab = 'Value' > par1 <- '0' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa, P. (2012), Kernel Density Estimation (v1.0.7) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_density.wasp/ > #Source of accompanying publication: http://www.xycoon.com/density_trace.htm > # > if (par1 == '0') bw <- 'nrd0' > if (par1 != '0') bw <- as.numeric(par1) > postscript(file="/var/wessaorg/rcomp/tmp/1b6fz1340192174.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > mydensity1<-density(x,bw=bw,kernel='gaussian',na.rm=TRUE) > plot(mydensity1,main='Gaussian Kernel',xlab=xlab,ylab=ylab) > grid() > dev.off() null device 1 > mydensity1 Call: density.default(x = x, bw = bw, kernel = "gaussian", na.rm = TRUE) Data: x (164 obs.); Bandwidth 'bw' = 16.65 x y Min. :-49.95 Min. :5.224e-06 1st Qu.: 21.53 1st Qu.:1.070e-03 Median : 93.00 Median :3.255e-03 Mean : 93.00 Mean :3.494e-03 3rd Qu.:164.47 3rd Qu.:5.962e-03 Max. :235.95 Max. :7.250e-03 > postscript(file="/var/wessaorg/rcomp/tmp/2dlrg1340192174.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > mydensity2<-density(x,bw=bw,kernel='epanechnikov',na.rm=TRUE) > plot(mydensity2,main='Epanechnikov Kernel',xlab=xlab,ylab=ylab) > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3rntj1340192174.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > mydensity3<-density(x,bw=bw,kernel='rectangular',na.rm=TRUE) > plot(mydensity3,main='Rectangular Kernel',xlab=xlab,ylab=ylab) > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/4q2cu1340192174.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > mydensity4<-density(x,bw=bw,kernel='triangular',na.rm=TRUE) > plot(mydensity4,main='Triangular Kernel',xlab=xlab,ylab=ylab) > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/58fw91340192174.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > mydensity5<-density(x,bw=bw,kernel='biweight',na.rm=TRUE) > plot(mydensity5,main='Biweight Kernel',xlab=xlab,ylab=ylab) > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6pfom1340192174.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > mydensity6<-density(x,bw=bw,kernel='cosine',na.rm=TRUE) > plot(mydensity6,main='Cosine Kernel',xlab=xlab,ylab=ylab) > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7xyfn1340192174.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > mydensity7<-density(x,bw=bw,kernel='optcosine',na.rm=TRUE) > plot(mydensity7,main='Optcosine Kernel',xlab=xlab,ylab=ylab) > grid() > dev.off() null device 1 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Properties of Density Trace',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Bandwidth',header=TRUE) > a<-table.element(a,mydensity1$bw) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'#Observations',header=TRUE) > a<-table.element(a,mydensity1$n) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/836zf1340192174.tab") > > try(system("convert tmp/1b6fz1340192174.ps tmp/1b6fz1340192174.png",intern=TRUE)) character(0) > try(system("convert tmp/2dlrg1340192174.ps tmp/2dlrg1340192174.png",intern=TRUE)) character(0) > try(system("convert tmp/3rntj1340192174.ps tmp/3rntj1340192174.png",intern=TRUE)) character(0) > try(system("convert tmp/4q2cu1340192174.ps tmp/4q2cu1340192174.png",intern=TRUE)) character(0) > try(system("convert tmp/58fw91340192174.ps tmp/58fw91340192174.png",intern=TRUE)) character(0) > try(system("convert tmp/6pfom1340192174.ps tmp/6pfom1340192174.png",intern=TRUE)) character(0) > try(system("convert tmp/7xyfn1340192174.ps tmp/7xyfn1340192174.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.983 0.525 2.516