R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(-1,-2,-5,-4,-6,-2,-2,-2,-2,2,1,-8,-1,1,-1,2,2,1,-1,-2,-2,-1,-8,-4,-6,-3,-3,-7,-9,-11,-13,-11,-9,-17,-22,-25,-20,-24,-24,-22,-19,-18,-17,-11,-11,-12,-10,-15,-15,-15,-13,-8,-13,-9,-7,-4,-4,-2,0,-2,-3,1,-2,-1,1,-3,-4,-9,-9,-7,-14,-12,-16,-20,-12,-12,-10,-10,-13,-16,-14,-17,-24,-25) > par3 = '0' > par2 = '5' > par1 = '50' > par3 <- '0' > par2 <- '5' > par1 <- '50' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: root > #To cite this work: Wessa P., (2013), Bootstrap Plot for Central Tendency (v1.0.11) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_bootstrapplot1.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par1 <- as.numeric(par1) > par2 <- as.numeric(par2) > if (par3 == '0') bw <- NULL > if (par3 != '0') bw <- as.numeric(par3) > if (par1 < 10) par1 = 10 > if (par1 > 5000) par1 = 5000 > library(modeest) This is package 'modeest' written by Paul PONCET. For a complete list of functions, use 'library(help = "modeest")' or 'help.start()'. > library(lattice) > library(boot) Attaching package: 'boot' The following object(s) are masked from 'package:lattice': melanoma > boot.stat <- function(s,i) + { + s.mean <- mean(s[i]) + s.median <- median(s[i]) + s.midrange <- (max(s[i]) + min(s[i])) / 2 + s.mode <- mlv(s[i], method='mfv')$M + s.kernelmode <- mlv(s[i], method='kernel', bw=bw)$M + c(s.mean, s.median, s.midrange, s.mode, s.kernelmode) + } > (r <- boot(x,boot.stat, R=par1, stype='i')) ORDINARY NONPARAMETRIC BOOTSTRAP Call: boot(data = x, statistic = boot.stat, R = par1, stype = "i") Bootstrap Statistics : original bias std. error t1* -8.654762 -0.107619 0.9203366 t2* -8.000000 -0.130000 1.4385721 t3* -11.500000 0.060000 0.2969230 t4* -2.000000 -1.425000 3.3792018 t5* -1.962534 -1.791812 3.4865936 There were 25 warnings (use warnings() to see them) > postscript(file="/var/wessaorg/rcomp/tmp/1m6121369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(r$t[,1],type='p',ylab='simulated values',main='Simulation of Mean') > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/2qgcs1369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(r$t[,2],type='p',ylab='simulated values',main='Simulation of Median') > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3jrrw1369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(r$t[,3],type='p',ylab='simulated values',main='Simulation of Midrange') > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/4lrn91369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(r$t[,4],type='p',ylab='simulated values',main='Simulation of Mode') > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5x1pt1369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(r$t[,5],type='p',ylab='simulated values',main='Simulation of Mode of Kernel Density') > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/65ic41369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~r$t[,1],col='black',main='Density Plot',xlab='mean') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7x6f11369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~r$t[,2],col='black',main='Density Plot',xlab='median') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/82gei1369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~r$t[,3],col='black',main='Density Plot',xlab='midrange') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/988jk1369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~r$t[,4],col='black',main='Density Plot',xlab='mode') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/10kyli1369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~r$t[,5],col='black',main='Density Plot',xlab='mode of kernel dens.') > dev.off() null device 1 > z <- data.frame(cbind(r$t[,1],r$t[,2],r$t[,3],r$t[,4],r$t[,5])) > colnames(z) <- list('mean','median','midrange','mode','mode k.dens') > postscript(file="/var/wessaorg/rcomp/tmp/11lo3t1369235663.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > boxplot(z,notch=TRUE,ylab='simulated values',main='Bootstrap Simulation - Central Tendency') Warning message: In bxp(list(stats = c(-10.8928571428571, -9.48809523809524, -8.70238095238095, : some notches went outside hinges ('box'): maybe set notch=FALSE > 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,'Estimation Results of Bootstrap',10,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'statistic',header=TRUE) > a<-table.element(a,'P1',header=TRUE) > a<-table.element(a,'P5',header=TRUE) > a<-table.element(a,'Q1',header=TRUE) > a<-table.element(a,'Estimate',header=TRUE) > a<-table.element(a,'Q3',header=TRUE) > a<-table.element(a,'P95',header=TRUE) > a<-table.element(a,'P99',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'IQR',header=TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'mean',header=TRUE) > q1 <- quantile(r$t[,1],0.25)[[1]] > q3 <- quantile(r$t[,1],0.75)[[1]] > p01 <- quantile(r$t[,1],0.01)[[1]] > p05 <- quantile(r$t[,1],0.05)[[1]] > p95 <- quantile(r$t[,1],0.95)[[1]] > p99 <- quantile(r$t[,1],0.99)[[1]] > a<-table.element(a,signif(p01,par2)) > a<-table.element(a,signif(p05,par2)) > a<-table.element(a,signif(q1,par2)) > a<-table.element(a,signif(r$t0[1],par2)) > a<-table.element(a,signif(q3,par2)) > a<-table.element(a,signif(p95,par2)) > a<-table.element(a,signif(p99,par2)) > a<-table.element( a,signif( sqrt(var(r$t[,1])),par2 ) ) > a<-table.element(a,signif(q3-q1,par2)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'median',header=TRUE) > q1 <- quantile(r$t[,2],0.25)[[1]] > q3 <- quantile(r$t[,2],0.75)[[1]] > p01 <- quantile(r$t[,2],0.01)[[1]] > p05 <- quantile(r$t[,2],0.05)[[1]] > p95 <- quantile(r$t[,2],0.95)[[1]] > p99 <- quantile(r$t[,2],0.99)[[1]] > a<-table.element(a,signif(p01,par2)) > a<-table.element(a,signif(p05,par2)) > a<-table.element(a,signif(q1,par2)) > a<-table.element(a,signif(r$t0[2],par2)) > a<-table.element(a,signif(q3,par2)) > a<-table.element(a,signif(p95,par2)) > a<-table.element(a,signif(p99,par2)) > a<-table.element(a,signif(sqrt(var(r$t[,2])),par2)) > a<-table.element(a,signif(q3-q1,par2)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'midrange',header=TRUE) > q1 <- quantile(r$t[,3],0.25)[[1]] > q3 <- quantile(r$t[,3],0.75)[[1]] > p01 <- quantile(r$t[,3],0.01)[[1]] > p05 <- quantile(r$t[,3],0.05)[[1]] > p95 <- quantile(r$t[,3],0.95)[[1]] > p99 <- quantile(r$t[,3],0.99)[[1]] > a<-table.element(a,signif(p01,par2)) > a<-table.element(a,signif(p05,par2)) > a<-table.element(a,signif(q1,par2)) > a<-table.element(a,signif(r$t0[3],par2)) > a<-table.element(a,signif(q3,par2)) > a<-table.element(a,signif(p95,par2)) > a<-table.element(a,signif(p99,par2)) > a<-table.element(a,signif(sqrt(var(r$t[,3])),par2)) > a<-table.element(a,signif(q3-q1,par2)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'mode',header=TRUE) > q1 <- quantile(r$t[,4],0.25)[[1]] > q3 <- quantile(r$t[,4],0.75)[[1]] > p01 <- quantile(r$t[,4],0.01)[[1]] > p05 <- quantile(r$t[,4],0.05)[[1]] > p95 <- quantile(r$t[,4],0.95)[[1]] > p99 <- quantile(r$t[,4],0.99)[[1]] > a<-table.element(a,signif(p01,par2)) > a<-table.element(a,signif(p05,par2)) > a<-table.element(a,signif(q1,par2)) > a<-table.element(a,signif(r$t0[4],par2)) > a<-table.element(a,signif(q3,par2)) > a<-table.element(a,signif(p95,par2)) > a<-table.element(a,signif(p99,par2)) > a<-table.element(a,signif(sqrt(var(r$t[,4])),par2)) > a<-table.element(a,signif(q3-q1,par2)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'mode k.dens',header=TRUE) > q1 <- quantile(r$t[,5],0.25)[[1]] > q3 <- quantile(r$t[,5],0.75)[[1]] > p01 <- quantile(r$t[,5],0.01)[[1]] > p05 <- quantile(r$t[,5],0.05)[[1]] > p95 <- quantile(r$t[,5],0.95)[[1]] > p99 <- quantile(r$t[,5],0.99)[[1]] > a<-table.element(a,signif(p01,par2)) > a<-table.element(a,signif(p05,par2)) > a<-table.element(a,signif(q1,par2)) > a<-table.element(a,signif(r$t0[5],par2)) > a<-table.element(a,signif(q3,par2)) > a<-table.element(a,signif(p95,par2)) > a<-table.element(a,signif(p99,par2)) > a<-table.element(a,signif(sqrt(var(r$t[,5])),par2)) > a<-table.element(a,signif(q3-q1,par2)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/12fnkk1369235663.tab") > > try(system("convert tmp/1m6121369235663.ps tmp/1m6121369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/2qgcs1369235663.ps tmp/2qgcs1369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/3jrrw1369235663.ps tmp/3jrrw1369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/4lrn91369235663.ps tmp/4lrn91369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/5x1pt1369235663.ps tmp/5x1pt1369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/65ic41369235663.ps tmp/65ic41369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/7x6f11369235663.ps tmp/7x6f11369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/82gei1369235663.ps tmp/82gei1369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/988jk1369235663.ps tmp/988jk1369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/10kyli1369235663.ps tmp/10kyli1369235663.png",intern=TRUE)) character(0) > try(system("convert tmp/11lo3t1369235663.ps tmp/11lo3t1369235663.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 8.002 1.487 9.476