R version 2.9.0 (2009-04-17) Copyright (C) 2009 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. > x <- c(14,8,12,7,10,7,16,11,14,6,16,11,16,12,7,13,11,15,7,9,7,14,15,7,15,17,15,14,14,8,8,14,14,8,11,16,10,8,14,16,13,5,8,10,8,13,15,6,12,16,5,15,12,8,13,14,12,16,10,15,8,16,19,14,6,13,15,7,13,4,14,13,11,14,12,15,14,13,8,6,7,13,13,11,5,12,8,11,14,9,10,13,16,16,11,8,4,7,14,11,17,15,17,5,4,10,11,15,10,9,12,15,7,13,12,14,14,8,15,12,12,16,9,15,15,6,14,15,10,6,14,12,8,11,13,9,15,13,15,14,16,14,14,10,10,4,8,15,16,12,12,15,9,12,14,11) > 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* 11.60256 -0.005192308 0.1869681 t2* 12.00000 0.196000000 0.4241979 > z <- data.frame(cbind(r$t[,1],r$t[,2])) Warning message: In data.row.names(row.names, rowsi, i) : some row.names duplicated: 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271 [... truncated] > colnames(z) <- list('mean','median') > postscript(file="/var/www/html/rcomp/tmp/1zycs1289491523.ps",horizontal=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,] 11.13462 12 [2,] 11.45513 12 [3,] 11.58974 12 [4,] 11.73718 12 [5,] 12.16026 12 $n [1] 500 500 $conf [,1] [,2] [1,] 11.56981 12 [2,] 11.60967 12 $out [1] 12.21795 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 12.50000 [9] 13.00000 13.00000 13.00000 13.00000 12.50000 12.50000 13.00000 13.00000 [17] 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 [25] 11.00000 13.00000 13.00000 12.50000 13.00000 12.50000 13.00000 12.50000 [33] 11.00000 13.00000 13.00000 13.00000 11.50000 13.00000 13.00000 13.00000 [41] 11.00000 13.00000 13.00000 13.00000 13.00000 13.00000 11.50000 12.50000 [49] 13.00000 13.00000 13.00000 13.00000 12.50000 11.50000 13.00000 13.00000 [57] 13.00000 12.50000 12.50000 13.00000 11.50000 13.00000 13.00000 12.50000 [65] 11.00000 13.00000 12.50000 12.50000 13.00000 13.00000 12.50000 13.00000 [73] 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 11.00000 13.00000 [81] 13.00000 13.00000 12.50000 13.00000 13.00000 13.00000 13.00000 13.00000 [89] 12.50000 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 [97] 13.00000 13.00000 13.00000 13.00000 12.50000 11.00000 13.00000 13.00000 [105] 13.00000 13.00000 13.00000 13.00000 13.00000 12.50000 13.00000 13.00000 [113] 13.00000 12.50000 11.50000 13.00000 13.00000 13.00000 13.00000 13.00000 [121] 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 13.00000 $group [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 2 2 2 2 2 2 [38] 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 2 2 2 2 2 2 2 [75] 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 2 2 2 2 2 2 2 [112] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 $names [1] "mean" "median" > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/www/html/rcomp/tmp/2d8aj1289491523.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/www/html/rcomp/tmp/3gr8p1289491523.tab") > > try(system("convert tmp/1zycs1289491523.ps tmp/1zycs1289491523.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.839 0.185 0.966