R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 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(115.01 + ,124.56 + ,128.60 + ,131.54 + ,124.93 + ,126.77 + ,128.97 + ,149.91 + ,149.55 + ,149.91 + ,159.47 + ,162.04 + ,163.88 + ,166.82 + ,173.80 + ,172.06 + ,178.21 + ,174.53 + ,176.37 + ,168.65 + ,166.82 + ,164.24 + ,163.51 + ,164.61 + ,163.51 + ,164.61 + ,167.92 + ,160.94 + ,156.53 + ,159.47 + ,149.18 + ,135.58 + ,124.93 + ,116.84 + ,114.27 + ,114.64 + ,112.80 + ,113.17 + ,111.33 + ,113.91 + ,119.42 + ,120.89 + ,122.04 + ,120.15 + ,118.21 + ,125.33 + ,135.37 + ,146.89 + ,149.54 + ,160.84 + ,169.95 + ,177.13 + ,169.35 + ,159.93 + ,149.69 + ,148.67 + ,136.32 + ,128.17 + ,138.74 + ,140.58 + ,147.57 + ,147.83 + ,155.65 + ,148.88 + ,147.90 + ,141.99 + ,136.58 + ,121.82 + ,127.52 + ,129.80 + ,131.29 + ,135.96 + ,146.50 + ,158.65 + ,153.21 + ,147.04 + ,141.04 + ,140.45 + ,140.15 + ,139.30 + ,137.60 + ,146.02 + ,158.79 + ,167.19 + ,161.99 + ,164.62 + ,156.21 + ,154.42 + ,150.39 + ,148.98 + ,158.61 + ,169.98 + ,190.09 + ,184.39 + ,193.67 + ,203.79 + ,204.07 + ,208.92 + ,206.88 + ,218.89 + ,215.52 + ,251.66 + ,262.11 + ,227.27 + ,202.60 + ,191.63 + ,178.71 + ,178.32 + ,176.41 + ,175.70 + ,175.73 + ,172.35 + ,176.61 + ,183.49 + ,172.59 + ,148.39 + ,138.31 + ,150.61 + ,151.74 + ,151.66 + ,149.88 + ,144.62 + ,137.10 + ,140.05 + ,138.92 + ,130.15 + ,128.92 + ,120.64 + ,118.54 + ,107.95 + ,107.93 + ,126.54 + ,130.21 + ,126.21 + ,125.29 + ,117.03 + ,117.34 + ,113.87 + ,113.00 + ,111.41 + ,103.02 + ,111.41 + ,113.19 + ,108.10 + ,108.80 + ,102.16 + ,105.83 + ,108.41 + ,105.70 + ,105.11 + ,110.78 + ,113.51 + ,108.98 + ,108.28 + ,117.49 + ,128.22 + ,127.73 + ,128.01 + ,132.84 + ,128.12 + ,130.28 + ,129.30 + ,135.00 + ,127.23 + ,123.79 + ,121.92 + ,122.03 + ,123.34 + ,125.27 + ,122.53 + ,125.31 + ,123.28 + ,122.56 + ,123.72 + ,121.46 + ,132.03 + ,149.30 + ,161.26 + ,187.84 + ,190.32 + ,176.26 + ,168.98 + ,149.60 + ,150.84 + ,141.81 + ,138.62 + ,141.96 + ,131.35 + ,131.62 + ,148.72 + ,145.62 + ,147.46 + ,160.55 + ,165.57 + ,166.33 + ,161.39 + ,166.28 + ,166.58 + ,163.73 + ,154.74 + ,150.60 + ,141.29 + ,151.03 + ,150.15 + ,156.57 + ,153.87 + ,153.59 + ,151.30 + ,150.99 + ,140.88 + ,144.25 + ,141.93 + ,143.87 + ,149.36 + ,159.71 + ,167.83 + ,161.12 + ,164.44 + ,167.16 + ,179.84 + ,174.44 + ,180.35 + ,193.17 + ,195.16 + ,202.43 + ,189.91 + ,195.98 + ,212.09 + ,205.81 + ,204.31 + ,196.07 + ,199.98 + ,199.10 + ,198.31 + ,195.72 + ,223.04 + ,238.41 + ,259.73 + ,326.54 + ,335.15 + ,321.81 + ,368.62 + ,369.59 + ,425.00 + ,439.72 + ,362.23 + ,328.76 + ,348.55 + ,328.18 + ,329.34 + ,295.55 + ,237.38 + ,226.85 + ,220.14 + ,239.36 + ,224.69 + ,230.98 + ,233.47 + ,256.70 + ,253.41 + ,224.95 + ,210.37 + ,191.09 + ,198.85 + ,211.04 + ,206.25 + ,201.51 + ,194.54 + ,191.07 + ,192.82 + ,181.88 + ,157.67 + ,195.82 + ,246.25 + ,271.69 + ,270.23 + ,274.08 + ,306.53 + ,326.55 + ,348.15 + ,316.75 + ,336.12 + ,354.47 + ,326.43 + ,303.88 + ,327.07 + ,315.92 + ,289.01 + ,281.01 + ,269.03 + ,274.89 + ,277.77 + ,283.88 + ,266.32 + ,264.36 + ,276.19 + ,345.69 + ,349.40 + ,353.42 + ,358.20 + ,361.00) > par2 = '12' > par1 = '500' > par2 <- '12' > par1 <- '500' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Blocked Bootstrap Plot for Central Tendency (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_bootstrapplot.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par1 <- as.numeric(par1) > par2 <- as.numeric(par2) > if (par1 < 10) par1 = 10 > if (par1 > 5000) par1 = 5000 > if (par2 < 3) par2 = 3 > if (par2 > length(x)) par2 = length(x) > library(lattice) > library(boot) Attaching package: 'boot' The following object(s) are masked from 'package:lattice': melanoma > boot.stat <- function(s) + { + s.mean <- mean(s) + s.median <- median(s) + s.midrange <- (max(s) + min(s)) / 2 + c(s.mean, s.median, s.midrange) + } > (r <- tsboot(x, boot.stat, R=par1, l=12, sim='fixed')) BLOCK BOOTSTRAP FOR TIME SERIES Fixed Block Length of 12 Call: tsboot(tseries = x, statistic = boot.stat, R = par1, l = 12, sim = "fixed") Bootstrap Statistics : original bias std. error t1* 178.8793 0.3925411 12.372531 t2* 158.6500 -0.0853600 9.538811 t3* 270.9400 -11.6934300 18.627354 > postscript(file="/var/wessaorg/rcomp/tmp/1100z1355066975.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/2dlh31355066975.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/34s671355066975.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/4614l1355066975.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/5nxhd1355066975.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/6lhom1355066975.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 > z <- data.frame(cbind(r$t[,1],r$t[,2],r$t[,3])) > colnames(z) <- list('mean','median','midrange') > postscript(file="/var/wessaorg/rcomp/tmp/7m4j41355066975.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(146.268471760797, 170.855996677741, 179.257940199336, : 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 Blocked Bootstrap',6,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'statistic',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,'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]] > a<-table.element(a,q1) > a<-table.element(a,r$t0[1]) > a<-table.element(a,q3) > a<-table.element(a,sqrt(var(r$t[,1]))) > a<-table.element(a,q3-q1) > 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]] > a<-table.element(a,q1) > a<-table.element(a,r$t0[2]) > a<-table.element(a,q3) > a<-table.element(a,sqrt(var(r$t[,2]))) > a<-table.element(a,q3-q1) > 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]] > a<-table.element(a,q1) > a<-table.element(a,r$t0[3]) > a<-table.element(a,q3) > a<-table.element(a,sqrt(var(r$t[,3]))) > a<-table.element(a,q3-q1) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/8pxva1355066975.tab") > > try(system("convert tmp/1100z1355066975.ps tmp/1100z1355066975.png",intern=TRUE)) character(0) > try(system("convert tmp/2dlh31355066975.ps tmp/2dlh31355066975.png",intern=TRUE)) character(0) > try(system("convert tmp/34s671355066975.ps tmp/34s671355066975.png",intern=TRUE)) character(0) > try(system("convert tmp/4614l1355066975.ps tmp/4614l1355066975.png",intern=TRUE)) character(0) > try(system("convert tmp/5nxhd1355066975.ps tmp/5nxhd1355066975.png",intern=TRUE)) character(0) > try(system("convert tmp/6lhom1355066975.ps tmp/6lhom1355066975.png",intern=TRUE)) character(0) > try(system("convert tmp/7m4j41355066975.ps tmp/7m4j41355066975.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.152 0.774 5.914