R version 2.7.2 (2008-08-25) Copyright (C) 2008 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(2194,2419,2742,2137,2710,2173,2363,2126,1905,2121,1983,1734,2074,2049,2406,2558,2251,2059,2397,1747,1707,2319,1631,1627,1791,2034,1997,2169,2028,2253,2218,1855,2187,1852,1570,1851,1954,1828,2251,2277,2085,2282,2266,1878,2267,2069,1746,2299,2360,2214,2825,2355,2333,3016,2155,2172,2150,2533,2058,2160,2259,2498,2695,2799,2945,2930,2318,2540,2570,2669,2450,2842,2760,2677,2979,2257,2842,2546,2455,2293,2379,2478,2054,2272,2351,2271,2542,2304,2194,2722,2395,2146,1894,2548,2087,2063,2481,2476,2212,2834,2148,2598) > par1 = '12' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Mean Plot (v1.0.1) 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 > #Technical description: Write here your technical program description > par1 <- as.numeric(par1) > (n <- length(x)) [1] 102 > (np <- floor(n / par1)) [1] 8 > arr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + if (j == par1) j = 0 + } > ari [1] 9 9 9 9 9 9 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 2194 2074 1791 1954 2360 2259 2760 2351 2481 [2,] 2419 2049 2034 1828 2214 2498 2677 2271 2476 [3,] 2742 2406 1997 2251 2825 2695 2979 2542 2212 [4,] 2137 2558 2169 2277 2355 2799 2257 2304 2834 [5,] 2710 2251 2028 2085 2333 2945 2842 2194 2148 [6,] 2173 2059 2253 2282 3016 2930 2546 2722 2598 [7,] 2363 2397 2218 2266 2155 2318 2455 2395 NA [8,] 2126 1747 1855 1878 2172 2540 2293 2146 NA [9,] 1905 1707 2187 2267 2150 2570 2379 1894 NA [10,] 2121 2319 1852 2069 2533 2669 2478 2548 NA [11,] 1983 1631 1570 1746 2058 2450 2054 2087 NA [12,] 1734 1627 1851 2299 2160 2842 2272 2063 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/www/html/rcomp/tmp/185j11226320599.ps",horizontal=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/www/html/rcomp/tmp/25s1d1226320599.ps",horizontal=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/www/html/rcomp/tmp/3xe9a1226320599.ps",horizontal=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/www/html/rcomp/tmp/4mx1g1226320599.ps",horizontal=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,] 1791 1828 1997 2137 2028 2059 2155.0 1747.0 1707.0 1852.0 1570.0 1627.0 [2,] 2074 2049 2251 2257 2148 2253 2242.0 1866.5 1899.5 2095.0 1688.5 1792.5 [3,] 2259 2271 2542 2304 2251 2546 2340.5 2136.0 2168.5 2398.5 2018.5 2111.5 [4,] 2360 2476 2742 2558 2710 2722 2396.0 2232.5 2323.0 2540.5 2072.5 2285.5 [5,] 2760 2677 2979 2834 2945 3016 2455.0 2540.0 2570.0 2669.0 2450.0 2842.0 $n [1] 9 9 9 9 9 9 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2108.373 2046.113 2283.407 2145.473 1955.013 2298.993 2254.473 1931.547 [2,] 2409.627 2495.887 2800.593 2462.527 2546.987 2793.007 2426.527 2340.453 [,9] [,10] [,11] [,12] [1,] 1931.927 2149.637 1803.992 1836.103 [2,] 2405.073 2647.363 2233.008 2386.897 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1791, 2074, 2259, 2360, 2760, 1828, 2049, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5weh01226320599.ps",horizontal=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] [1,] 1734 1627.0 1570.0 1746 2058.0 2259.0 2054.0 1894.0 2148.0 [2,] 2052 1727.0 1851.5 1916 2157.5 2474.0 2282.5 2116.5 2212.0 [3,] 2155 2066.5 2012.5 2168 2273.5 2619.5 2466.5 2287.5 2478.5 [4,] 2391 2358.0 2178.0 2272 2446.5 2820.5 2718.5 2468.5 2598.0 [5,] 2742 2558.0 2253.0 2299 2825.0 2945.0 2979.0 2722.0 2834.0 $n [1] 12 12 12 12 12 12 12 12 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2000.38 1778.697 1863.581 2005.626 2141.685 2461.459 2267.637 2126.950 [2,] 2309.62 2354.303 2161.419 2330.374 2405.315 2777.541 2665.363 2448.050 [,9] [1,] 2229.518 [2,] 2727.482 $out [1] 3016 $group [1] 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(1734, 2052, 2155, 2391, 2742, 1627, 1727, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6u6xi1226320600.ps",horizontal=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,] 1947.375 2018.50 1891.250 [2,] 2119.188 2152.25 2074.438 [3,] 2297.438 2265.00 2292.438 [4,] 2401.444 2369.50 2418.250 [5,] 2516.556 2546.00 2496.500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2168.698 2165.911 2135.622 [2,] 2426.177 2364.089 2449.253 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1947.375, 2119.1875, 2297.4375, 2401.44444444444, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/185j11226320599.ps tmp/185j11226320599.png") > system("convert tmp/25s1d1226320599.ps tmp/25s1d1226320599.png") > system("convert tmp/3xe9a1226320599.ps tmp/3xe9a1226320599.png") > system("convert tmp/4mx1g1226320599.ps tmp/4mx1g1226320599.png") > system("convert tmp/5weh01226320599.ps tmp/5weh01226320599.png") > system("convert tmp/6u6xi1226320600.ps tmp/6u6xi1226320600.png") > > > proc.time() user system elapsed 1.346 0.857 1.965