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(68.897,38.683,44.720,39.525,45.315,50.380,40.600,36.279,42.438,38.064,31.879,11.379,70.249,39.253,47.060,41.697,38.708,49.267,39.018,32.228,40.870,39.383,34.571,12.066,70.938,34.077,45.409,40.809,37.013,44.953,37.848,32.745,39.401,34.931,33.008,8.620,68.906,39.556,50.669,36.432,40.891,48.428,36.222,33.425,39.401,37.967,34.801,12.657,69.116,41.519,51.321,38.529,41.547,52.073,38.401,40.898,40.439,41.888,37.898,8.771,68.184,50.530,47.221,41.756,45.633,48.138,39.486,39.341,41.117,41.629,29.722,7.054,56.676,34.870,35.117,30.169,30.936,35.699,33.228,27.733,33.666,35.429,27.438,8.170,63.410,38.040,45.389,37.353,37.024,50.957,37.994,36.454,46.080,43.373,37.395) > par2 = '12' > par1 = '500' > 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) + c(s.mean, s.median) + } > (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* 39.75207 3.425263e-05 1.0652751 t2* 39.34100 -2.622520e-01 0.9736849 > z <- data.frame(cbind(r$t[,1],r$t[,2])) > colnames(z) <- list('mean','median') > postscript(file="/var/wessaorg/rcomp/tmp/1z41l1321874477.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > b <- boxplot(z,notch=TRUE,ylab='simulated values',main='Bootstrap Simulation - Central Tendency') > grid() > dev.off() null device 1 > b $stats [,1] [,2] [1,] 37.15789 37.848 [2,] 39.10219 38.683 [3,] 39.81456 39.341 [4,] 40.43675 39.486 [5,] 42.39914 40.600 $n [1] 500 500 $conf [,1] [,2] [1,] 39.72026 39.28426 [2,] 39.90886 39.39774 $out [1] 37.04148 37.06886 36.88572 37.02663 37.02212 36.58646 36.56135 36.33823 [9] 40.87000 36.43200 37.01300 37.39500 36.27900 40.80900 40.89800 35.69900 [17] 40.87000 40.80900 37.02400 40.80900 36.22200 37.35300 40.89800 37.35300 [25] 36.22200 37.39500 40.89800 37.39500 37.35300 40.80900 40.89100 37.39500 [33] 40.89100 40.89100 36.22200 37.01300 40.89800 37.39500 35.69900 40.80900 [41] 40.89800 37.35300 40.87000 37.02400 35.69900 37.35300 40.89800 35.69900 [49] 35.42900 36.45400 36.43200 37.02400 36.27900 37.02400 36.22200 37.02400 [57] 40.89800 40.89800 36.45400 $group [1] 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [39] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 $names [1] "mean" "median" > > #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.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/23ke91321874478.tab") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'95% Confidence Intervals',3,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'',1,TRUE) > a<-table.element(a,'Mean',1,TRUE) > a<-table.element(a,'Median',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Lower Bound',1,TRUE) > a<-table.element(a,b$conf[1,1]) > a<-table.element(a,b$conf[1,2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Upper Bound',1,TRUE) > a<-table.element(a,b$conf[2,1]) > a<-table.element(a,b$conf[2,2]) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/39jwd1321874478.tab") > > try(system("convert tmp/1z41l1321874477.ps tmp/1z41l1321874477.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.873 0.076 0.944