R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(1160,1220,1100,1030,1110,1160,1170,1090,1160,1210,1250,1200,1180,1210,950,1070,1120,1220,1170,1120,1180,1250,1240,1230,1120,1330,990,1110,1090,1210,1220,1220,1100,1200,1320,1180,1110,1300,1060,1130,1160,1260,1210,1190,1130,1170,1370,1170,1040,1340,1050,1130,1150,1220,1210,1150,1130,1150,1440,1160,1130,1350,1050,1150,1120,1170,1100,1120,1210,1170,1370,1170,1110,1320,1060,1150,1160,1230,1140,1100,1270,1160,1380,1150,1180,1370,1080,1160,1230,1210,1130,1110,1250,1210,1370,1080,1220,1360,1120,1150,1180,1250,1040,1180,1250,1120,1430,1150) > 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,] 1160 1180 1120 1110 1040 1130 1110 1180 1220 NA [2,] 1220 1210 1330 1300 1340 1350 1320 1370 1360 NA [3,] 1100 950 990 1060 1050 1050 1060 1080 1120 NA [4,] 1030 1070 1110 1130 1130 1150 1150 1160 1150 NA [5,] 1110 1120 1090 1160 1150 1120 1160 1230 1180 NA [6,] 1160 1220 1210 1260 1220 1170 1230 1210 1250 NA [7,] 1170 1170 1220 1210 1210 1100 1140 1130 1040 NA [8,] 1090 1120 1220 1190 1150 1120 1100 1110 1180 NA [9,] 1160 1180 1100 1130 1130 1210 1270 1250 1250 NA [10,] 1210 1250 1200 1170 1150 1170 1160 1210 1120 NA [11,] 1250 1240 1320 1370 1440 1370 1380 1370 1430 NA [12,] 1200 1230 1180 1170 1160 1170 1150 1080 1150 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 60 30 210 190 300 220 210 190 140 NA [2,] -120 -260 -340 -240 -290 -300 -260 -290 -240 NA [3,] -70 120 120 70 80 100 90 80 30 NA [4,] 80 50 -20 30 20 -30 10 70 30 NA [5,] 50 100 120 100 70 50 70 -20 70 NA [6,] 10 -50 10 -50 -10 -70 -90 -80 -210 NA [7,] -80 -50 0 -20 -60 20 -40 -20 140 NA [8,] 70 60 -120 -60 -20 90 170 140 70 NA [9,] 50 70 100 40 20 -40 -110 -40 -130 NA [10,] 40 -10 120 200 290 200 220 160 310 NA [11,] -50 -10 -140 -200 -280 -200 -230 -290 -280 NA [12,] -20 -110 -70 -130 -30 -60 30 140 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/wessaorg/rcomp/tmp/1oy8l1408035056.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/wessaorg/rcomp/tmp/2s2j01408035056.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/wessaorg/rcomp/tmp/39w8s1408035056.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/wessaorg/rcomp/tmp/4eou51408035056.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,] 1040 1300 1050 1070 1090 1210 1040 1090 1100 1120 1240 1150 [2,] 1110 1300 1050 1110 1120 1210 1130 1110 1130 1160 1320 1150 [3,] 1130 1330 1060 1130 1150 1220 1170 1120 1180 1170 1370 1170 [4,] 1180 1350 1080 1150 1160 1230 1210 1180 1250 1210 1380 1180 [5,] 1220 1370 1120 1160 1180 1260 1220 1220 1270 1250 1440 1200 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1093.133 1303.667 1044.2 1108.933 1128.933 1209.467 1127.867 1083.133 [2,] 1166.867 1356.333 1075.8 1151.067 1171.067 1230.533 1212.133 1156.867 [,9] [,10] [,11] [,12] [1,] 1116.8 1143.667 1338.4 1154.2 [2,] 1243.2 1196.333 1401.6 1185.8 $out [1] 1220 1210 950 990 1030 1230 1160 1170 1230 1080 $group [1] 2 2 3 3 4 5 6 6 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1040, 1110, 1130, 1180, 1220, 1300, 1300, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5amoc1408035056.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,] 60 -340 30 -30 -20 -90 -80 -120 -130 -10 -290 -130 [2,] 140 -290 70 10 50 -80 -50 -20 -40 120 -280 -90 [3,] 190 -260 80 30 70 -50 -20 70 20 200 -200 -45 [4,] 210 -240 100 50 100 -10 0 90 50 220 -140 5 [5,] 300 -240 120 80 120 10 20 170 100 310 -10 140 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 153.1333 -286.3333 64.2 8.933333 43.66667 -86.86667 -46.333333 12.06667 [2,] 226.8667 -233.6667 95.8 51.066667 96.33333 -13.13333 6.333333 127.93333 [,9] [,10] [,11] [,12] [1,] -27.4 147.3333 -273.7333 -98.068364 [2,] 67.4 252.6667 -126.2667 8.068364 $out [1] 30 -120 -70 -210 140 $group [1] 1 2 3 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(60, 140, 190, 210, 300, -340, -290, -260, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6lgw21408035056.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,] 1030 1070 990 1060 1040 1050 1060 1080 1040 NA [2,] 1105 1120 1105 1130 1130 1120 1125 1120 1135 NA [3,] 1160 1180 1190 1170 1150 1160 1155 1195 1180 NA [4,] 1205 1225 1220 1235 1215 1190 1250 1240 1250 NA [5,] 1250 1250 1330 1370 1340 1210 1380 1370 1360 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1114.389 1132.109 1137.548 1122.109 1111.231 1128.073 1097.987 1140.267 [2,] 1205.611 1227.891 1242.452 1217.891 1188.769 1191.927 1212.013 1249.733 [,9] [,10] [1,] 1127.548 NA [2,] 1232.452 NA $out [1] 950 1440 1350 1370 1430 $group [1] 2 5 6 6 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(1030, 1105, 1160, 1205, 1250, 1070, 1120, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7zqjl1408035056.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,] 1051.111 1060 1065.0 [2,] 1140.556 1130 1142.5 [3,] 1160.000 1170 1167.5 [4,] 1200.556 1200 1205.0 [5,] 1214.444 1220 1220.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1132.634 1138.073 1138.993 [2,] 1187.366 1201.927 1196.007 $out [1] 1311.111 1352.222 1330.000 1370.000 1325.000 1350.000 $group [1] 1 1 2 2 3 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1051.11111111111, 1140.55555555556, 1160, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1oy8l1408035056.ps tmp/1oy8l1408035056.png",intern=TRUE)) character(0) > try(system("convert tmp/2s2j01408035056.ps tmp/2s2j01408035056.png",intern=TRUE)) character(0) > try(system("convert tmp/39w8s1408035056.ps tmp/39w8s1408035056.png",intern=TRUE)) character(0) > try(system("convert tmp/4eou51408035056.ps tmp/4eou51408035056.png",intern=TRUE)) character(0) > try(system("convert tmp/5amoc1408035056.ps tmp/5amoc1408035056.png",intern=TRUE)) character(0) > try(system("convert tmp/6lgw21408035056.ps tmp/6lgw21408035056.png",intern=TRUE)) character(0) > try(system("convert tmp/7zqjl1408035056.ps tmp/7zqjl1408035056.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.522 0.362 2.916