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(3202.1,3650.2,2805.1,3957.5,3941.3,3905.4,3546.9,3208.7,3402,3661.1,3073.9,3419.2,3532.8,3693.1,2622.9,3130.8,3487.5,3349.7,3044.2,3266,3351.5,3606.8,3419.5,3829.5,3505.1,3845.3,2566.6,3658.5,3954,3460.1,3454.1,3412.8,3418,3349.5,3423.4,3242.8,3277.2,3833,2606.3,3643.8,3686.4,3281.6,3669.3,3191.5,3512.7,3970.7,3601.2,3610,4172.1,3956.2,3142.7,3884.3,3892.2,3613,3730.5,3481.3,3649.5,4215.2,4066.6,4196.8,4536.6,4441.6,3548.3,4735.9,4130.6,4356.2,4159.6,3988,4167.8,4902.2,3909.4,4697.6,4308.9,4420.4,3544.2,4433,4479.7,4533.2,4237.5,4207.4,4394,5148.4,4202.2,4682.5,4884.3,5288.9,4505.2,4611.5,5081.1,4523.1,4412.8,4647.4,4778.6,4495.3,4633.5,4360.5,4517.9) > 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] 97 > (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 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 3202.1 3532.8 3505.1 3277.2 4172.1 4536.6 4308.9 4884.3 4517.9 [2,] 3650.2 3693.1 3845.3 3833.0 3956.2 4441.6 4420.4 5288.9 NA [3,] 2805.1 2622.9 2566.6 2606.3 3142.7 3548.3 3544.2 4505.2 NA [4,] 3957.5 3130.8 3658.5 3643.8 3884.3 4735.9 4433.0 4611.5 NA [5,] 3941.3 3487.5 3954.0 3686.4 3892.2 4130.6 4479.7 5081.1 NA [6,] 3905.4 3349.7 3460.1 3281.6 3613.0 4356.2 4533.2 4523.1 NA [7,] 3546.9 3044.2 3454.1 3669.3 3730.5 4159.6 4237.5 4412.8 NA [8,] 3208.7 3266.0 3412.8 3191.5 3481.3 3988.0 4207.4 4647.4 NA [9,] 3402.0 3351.5 3418.0 3512.7 3649.5 4167.8 4394.0 4778.6 NA [10,] 3661.1 3606.8 3349.5 3970.7 4215.2 4902.2 5148.4 4495.3 NA [11,] 3073.9 3419.5 3423.4 3601.2 4066.6 3909.4 4202.2 4633.5 NA [12,] 3419.2 3829.5 3242.8 3610.0 4196.8 4697.6 4682.5 4360.5 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/1kox31225388615.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/2y55g1225388615.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/34e1i1225388615.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/4jk0e1225388615.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] [1,] 3202.1 3650.20 2566.60 3130.80 3487.50 3281.60 3044.20 3191.50 3351.5 [2,] 3505.1 3763.05 2614.60 3651.15 3789.30 3404.90 3500.50 3237.35 3410.0 [3,] 4172.1 3900.75 2973.90 3920.90 3947.65 3759.20 3699.90 3447.05 3581.1 [4,] 4517.9 4431.00 3546.25 4522.25 4305.15 4439.65 4198.55 4097.70 4280.9 [5,] 4884.3 5288.90 4505.20 4735.90 4479.70 4533.20 4412.80 4647.40 4778.6 [,10] [,11] [,12] [1,] 3349.50 3073.90 3242.80 [2,] 3633.95 3421.45 3514.60 [3,] 4092.95 3755.30 4013.15 [4,] 4698.75 4134.40 4521.50 [5,] 5148.40 4633.50 4697.60 $n [1] 9 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3638.692 3527.624 2453.467 3434.291 3659.489 3181.174 3309.959 2966.446 [2,] 4705.508 4273.876 3494.333 4407.509 4235.811 4337.226 4089.841 3927.654 [,9] [,10] [,11] [,12] [1,] 3094.603 3498.137 3357.036 3450.681 [2,] 4067.597 4687.763 4153.564 4575.619 $out [1] 5081.1 $group [1] 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(3202.1, 3505.1, 4172.1, 4517.9, 4884.3, 3650.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5e41i1225388615.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,] 2805.10 3044.2 3242.80 3191.50 3142.70 3548.3 4202.20 4360.50 4517.9 [2,] 3205.40 3198.4 3381.15 3279.40 3631.25 4059.3 4222.45 4500.25 4517.9 [3,] 3483.05 3385.5 3438.75 3605.60 3888.25 4262.0 4407.20 4622.50 4517.9 [4,] 3783.25 3569.8 3581.80 3677.85 4119.35 4617.1 4506.45 4831.45 4517.9 [5,] 3957.50 3829.5 3845.30 3970.70 4215.20 4902.2 4682.50 5288.90 4517.9 $n [1] 12 12 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3219.489 3216.102 3347.232 3423.864 3665.624 4007.584 4277.666 4471.437 [2,] 3746.611 3554.898 3530.268 3787.336 4110.876 4516.416 4536.734 4773.563 [,9] [1,] 4517.9 [2,] 4517.9 $out [1] 2622.9 2566.6 3954.0 2606.3 3544.2 5148.4 $group [1] 2 3 3 4 7 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(2805.1, 3205.4, 3483.05, 3783.25, 3957.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6qx041225388615.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,] 3675.387 3447.050 3647.262 [2,] 3786.538 3640.500 3790.319 [3,] 3935.394 3829.975 3958.431 [4,] 4044.256 3980.400 4047.769 [5,] 4168.650 4172.100 4122.275 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3817.846 3674.944 3841.007 [2,] 4052.941 3985.006 4075.856 $out [1] 3167.662 2973.900 3081.987 $group [1] 1 2 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(3675.3875, 3786.5375, 3935.39375, 4044.25625, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1kox31225388615.ps tmp/1kox31225388615.png") > system("convert tmp/2y55g1225388615.ps tmp/2y55g1225388615.png") > system("convert tmp/34e1i1225388615.ps tmp/34e1i1225388615.png") > system("convert tmp/4jk0e1225388615.ps tmp/4jk0e1225388615.png") > system("convert tmp/5e41i1225388615.ps tmp/5e41i1225388615.png") > system("convert tmp/6qx041225388615.ps tmp/6qx041225388615.png") > > > proc.time() user system elapsed 1.245 0.811 1.552