R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing 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(2240,2240,2380,2380,2380,2380,2140,2400,2180,2260,2280,2480,2360,2160,2380,2280,2320,2400,1960,2520,2200,2420,2300,2280,2220,2240,2200,2340,2240,2500,1820,2520,2180,2480,2260,2400,2240,2240,2240,2140,2200,2460,1860,2480,1960,2540,2280,2320,2320,2440,2320,2180,2120,2460,2140,2480,2100,2700,2200,2260,2340,2720,2300,2360,2020,2380,2000,2540,1980,2940,2260,2300,2300,2820,2380,2360,1980,2340,2160,2700,1920,2980,2240,2180,2440,2740,2360,2380,2000,2500,2180,2740,1960,3060,2300,2240,2580,2740,2260,2400,1820,2440,2080,2680,1900,3000,2240,2300) > par1 = '12' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Mean Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_meanplot.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par1 <- as.numeric(par1) > (n <- length(x)) [1] 108 > (np <- floor(n / par1)) [1] 9 > arr <- array(NA,dim=c(par1,np+1)) > darr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > dx <- diff(x) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + darr[j,ari[j]] <- dx[i] + if (j == par1) j = 0 + } > ari [1] 9 9 9 9 9 9 9 9 9 9 9 9 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 2240 2360 2220 2240 2320 2340 2300 2440 2580 NA [2,] 2240 2160 2240 2240 2440 2720 2820 2740 2740 NA [3,] 2380 2380 2200 2240 2320 2300 2380 2360 2260 NA [4,] 2380 2280 2340 2140 2180 2360 2360 2380 2400 NA [5,] 2380 2320 2240 2200 2120 2020 1980 2000 1820 NA [6,] 2380 2400 2500 2460 2460 2380 2340 2500 2440 NA [7,] 2140 1960 1820 1860 2140 2000 2160 2180 2080 NA [8,] 2400 2520 2520 2480 2480 2540 2700 2740 2680 NA [9,] 2180 2200 2180 1960 2100 1980 1920 1960 1900 NA [10,] 2260 2420 2480 2540 2700 2940 2980 3060 3000 NA [11,] 2280 2300 2260 2280 2200 2260 2240 2300 2240 NA [12,] 2480 2280 2400 2320 2260 2300 2180 2240 2300 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0 -200 20 0 120 380 520 300 160 NA [2,] 140 220 -40 0 -120 -420 -440 -380 -480 NA [3,] 0 -100 140 -100 -140 60 -20 20 140 NA [4,] 0 40 -100 60 -60 -340 -380 -380 -580 NA [5,] 0 80 260 260 340 360 360 500 620 NA [6,] -240 -440 -680 -600 -320 -380 -180 -320 -360 NA [7,] 260 560 700 620 340 540 540 560 600 NA [8,] -220 -320 -340 -520 -380 -560 -780 -780 -780 NA [9,] 80 220 300 580 600 960 1060 1100 1100 NA [10,] 20 -120 -220 -260 -500 -680 -740 -760 -760 NA [11,] 200 -20 140 40 60 40 -60 -60 60 NA [12,] -120 -60 -160 0 80 0 260 340 NA NA > arr.mean <- array(NA,dim=par1) > arr.median <- array(NA,dim=par1) > arr.midrange <- array(NA,dim=par1) > for (j in 1:par1) + { + arr.mean[j] <- mean(arr[j,],na.rm=TRUE) + arr.median[j] <- median(arr[j,],na.rm=TRUE) + arr.midrange[j] <- (quantile(arr[j,],0.75,na.rm=TRUE) + quantile(arr[j,],0.25,na.rm=TRUE)) / 2 + } > overall.mean <- mean(x) > overall.median <- median(x) > overall.midrange <- (quantile(x,0.75) + quantile(x,0.25)) / 2 > postscript(file="/var/fisher/rcomp/tmp/1jhbg1374851716.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.mean,type='b',ylab='mean',main='Mean Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.mean,0) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/2a3kp1374851716.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.median,type='b',ylab='median',main='Median Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.median,0) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/3b0e81374851716.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.midrange,type='b',ylab='midrange',main='Midrange Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.midrange,0) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/4eom61374851716.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(arr)) > names(z) <- c(1:par1) > (boxplot(z,notch=TRUE,col='grey',xlab='Periodic Index',ylab='Value',main='Notched Box Plots - Periodic Subseries')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 2220 2160 2200 2140 1820 2340 1820 2400 1900 2260 2200 2180 [2,] 2240 2240 2260 2280 2000 2380 1960 2480 1960 2480 2240 2260 [3,] 2320 2440 2320 2360 2120 2440 2080 2520 1980 2700 2260 2300 [4,] 2360 2740 2380 2380 2240 2460 2140 2680 2180 2980 2280 2320 [5,] 2440 2820 2380 2400 2380 2500 2180 2740 2200 3060 2300 2400 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 2256.8 2176.667 2256.8 2307.333 1993.6 2397.867 1985.2 2414.667 1864.133 [2,] 2383.2 2703.333 2383.2 2412.667 2246.4 2482.133 2174.8 2625.333 2095.867 [,10] [,11] [,12] [1,] 2436.667 2238.933 2268.4 [2,] 2963.333 2281.067 2331.6 $out [1] 2580 2480 $group [1] 1 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(2220, 2240, 2320, 2360, 2440, 2160, 2240, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5g5yl1374851716.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(darr)) > names(z) <- c(1:par1) > (boxplot(z,notch=TRUE,col='grey',xlab='Periodic Index',ylab='Value',main='Notched Box Plots - Differenced Periodic Subseries')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] -200 -480 -140 -580 260 -600 540 -780 80 -760 -60 -160 [2,] 0 -420 -100 -380 260 -440 540 -780 300 -740 -20 -90 [3,] 120 -120 0 -100 340 -360 560 -520 600 -500 40 0 [4,] 300 0 60 0 360 -320 600 -340 1060 -220 60 170 [5,] 520 220 140 60 500 -180 620 -220 1100 20 140 340 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -38 -341.2 -84.26667 -300.1333 287.3333 -423.2 528.4 -751.7333 199.7333 [2,] 278 101.2 84.26667 100.1333 392.6667 -296.8 591.6 -288.2667 1000.2667 [,10] [,11] [,12] [1,] -773.8667 -2.133333 -145.2397 [2,] -226.1333 82.133333 145.2397 $out [1] 0 80 620 -680 260 700 340 200 $group [1] 5 5 5 6 7 7 7 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-200, 0, 120, 300, 520, -480, -420, -120, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6dtm51374851716.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(arr) > names(z) <- c(1:np) > (boxplot(z,notch=TRUE,col='grey',xlab='Block Index',ylab='Value',main='Notched Box Plots - Sequential Blocks')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 2140 2160 2180 1860 2100 1980 1920 1960 1820 NA [2,] 2240 2240 2210 2170 2160 2140 2170 2210 2160 NA [3,] 2330 2310 2250 2240 2290 2320 2320 2370 2350 NA [4,] 2380 2390 2440 2390 2450 2460 2540 2620 2630 NA [5,] 2480 2520 2520 2540 2700 2940 2980 3060 3000 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2266.145 2241.584 2145.095 2139.657 2157.729 2174.046 2151.241 2182.996 [2,] 2393.855 2378.416 2354.905 2340.343 2422.271 2465.954 2488.759 2557.004 [,9] [,10] [1,] 2135.63 NA [2,] 2564.37 NA $out [1] 1960 1820 $group [1] 2 3 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(2140, 2240, 2330, 2380, 2480, 2160, 2240, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7uigb1374851716.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(cbind(arr.mean,arr.median,arr.midrange)) > names(z) <- list('mean','median','midrange') > (boxplot(z,notch=TRUE,col='grey',ylab='Overall Central Tendency',main='Notched Box Plots')) $stats [,1] [,2] [,3] [1,] 2037.778 1980 2050 [2,] 2191.111 2190 2190 [3,] 2313.333 2320 2310 [4,] 2455.556 2440 2455 [5,] 2708.889 2700 2730 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2192.718 2205.973 2189.132 [2,] 2433.948 2434.027 2430.868 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(2037.77777777778, 2191.11111111111, 2313.33333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1jhbg1374851716.ps tmp/1jhbg1374851716.png",intern=TRUE)) character(0) > try(system("convert tmp/2a3kp1374851716.ps tmp/2a3kp1374851716.png",intern=TRUE)) character(0) > try(system("convert tmp/3b0e81374851716.ps tmp/3b0e81374851716.png",intern=TRUE)) character(0) > try(system("convert tmp/4eom61374851716.ps tmp/4eom61374851716.png",intern=TRUE)) character(0) > try(system("convert tmp/5g5yl1374851716.ps tmp/5g5yl1374851716.png",intern=TRUE)) character(0) > try(system("convert tmp/6dtm51374851716.ps tmp/6dtm51374851716.png",intern=TRUE)) character(0) > try(system("convert tmp/7uigb1374851716.ps tmp/7uigb1374851716.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.821 0.717 4.523