x <- c(203.7,173.8,167.1,151.8,144.5,128.4,121.6,124.9,122.7,148.1,176.9,234.6,254.6,279.7,275.8,283,295.4,297.6,276.8,250.1,239.1,258.9,276.1,264.1,265.5,287.7,285.1,304.5,301.5,274.2,258.6,253.9,269.6,266.9,269.6,257.9,258.2,254.7,237.2,267.2,228.8,196.3,194.8,186.6,176.7,162.1,154.9,150.1,150.5,143.6,143.8,141.5,147.9,151.4,144.6,140.4,139.5,138.1,136.7,130,128.5,130.4,125.7,121.7,129.9,129.6,128.2,119.7,112.2,105.6,101.2,94.9,95.1,93.1,91.4,89.8,85.9,89.7,91.6,88.6,86.9,86.4,82.2,81.5,81.2) par2 = '12' par1 = '200' #'GNU S' R Code compiled by R2WASP v. 1.0.44 () #Author: Prof. Dr. P. Wessa #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ #Source of accompanying publication: Office for Research, Development, and Education #Technical description: Write here your technical program description (don't use hard returns!) 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) 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')) postscript(file="/var/www/html/rcomp/tmp/1o8h01260636255.ps",horizontal=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() postscript(file="/var/www/html/rcomp/tmp/2y04t1260636255.ps",horizontal=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() postscript(file="/var/www/html/rcomp/tmp/3dzyt1260636255.ps",horizontal=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() postscript(file="/var/www/html/rcomp/tmp/4i04i1260636255.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) densityplot(~r$t[,1],col='black',main='Density Plot',xlab='mean') dev.off() postscript(file="/var/www/html/rcomp/tmp/5sw2h1260636255.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) densityplot(~r$t[,2],col='black',main='Density Plot',xlab='median') dev.off() postscript(file="/var/www/html/rcomp/tmp/6vaj01260636255.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) densityplot(~r$t[,3],col='black',main='Density Plot',xlab='midrange') dev.off() z <- data.frame(cbind(r$t[,1],r$t[,2],r$t[,3])) colnames(z) <- list('mean','median','midrange') postscript(file="/var/www/html/rcomp/tmp/7nhem1260636255.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) boxplot(z,notch=TRUE,ylab='simulated values',main='Bootstrap Simulation - Central Tendency') grid() dev.off() #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.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/www/html/rcomp/tmp/8eplq1260636256.tab") try(system("convert tmp/1o8h01260636255.ps tmp/1o8h01260636255.png",intern=TRUE)) try(system("convert tmp/2y04t1260636255.ps tmp/2y04t1260636255.png",intern=TRUE)) try(system("convert tmp/3dzyt1260636255.ps tmp/3dzyt1260636255.png",intern=TRUE)) try(system("convert tmp/4i04i1260636255.ps tmp/4i04i1260636255.png",intern=TRUE)) try(system("convert tmp/5sw2h1260636255.ps tmp/5sw2h1260636255.png",intern=TRUE)) try(system("convert tmp/6vaj01260636255.ps tmp/6vaj01260636255.png",intern=TRUE)) try(system("convert tmp/7nhem1260636255.ps tmp/7nhem1260636255.png",intern=TRUE))