x <- c(20.1,20.1,20.1,20.3,20.7,20.6,20.3,19.9,19.7,19.4,19.1,18.8,18.9,18.7,18.8,19.5,19.3,19.1,19.1,19,18.8,19.2,18.9,18.7,18.5,18.4,18.3,18.3,18.3,18.5,19.2,19.4,19.1,19.5,18.8,19.3,20.4,20.9,21.1,20.6,20.4,20.8,21.1,21.6,22,22.2,22.4,22.8,22.7,22.8,22.9,22.9,22.6,21.9,20.8,20.3,20.4,21.2,21.4,20.9,20,19.5,19.2,19.3,19.4,19.5,20,20.1,19.5,18.6,18.4,18.4,19.3,19.8,19.8,19.8,20.1,20.3,19.7,20.2,20.6,21,21.4,21.9)
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))
(np <- floor(n / par1))
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
arr
darr
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/1rehn1385026851.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()
postscript(file="/var/wessaorg/rcomp/tmp/2goyt1385026851.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()
postscript(file="/var/wessaorg/rcomp/tmp/3o3tx1385026851.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()
postscript(file="/var/wessaorg/rcomp/tmp/4ffhr1385026851.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'))
dev.off()
postscript(file="/var/wessaorg/rcomp/tmp/52lsr1385026851.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'))
dev.off()
postscript(file="/var/wessaorg/rcomp/tmp/6sxw71385026851.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'))
dev.off()
postscript(file="/var/wessaorg/rcomp/tmp/7chpe1385026851.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'))
dev.off()

try(system("convert tmp/1rehn1385026851.ps tmp/1rehn1385026851.png",intern=TRUE))
try(system("convert tmp/2goyt1385026851.ps tmp/2goyt1385026851.png",intern=TRUE))
try(system("convert tmp/3o3tx1385026851.ps tmp/3o3tx1385026851.png",intern=TRUE))
try(system("convert tmp/4ffhr1385026851.ps tmp/4ffhr1385026851.png",intern=TRUE))
try(system("convert tmp/52lsr1385026851.ps tmp/52lsr1385026851.png",intern=TRUE))
try(system("convert tmp/6sxw71385026851.ps tmp/6sxw71385026851.png",intern=TRUE))
try(system("convert tmp/7chpe1385026851.ps tmp/7chpe1385026851.png",intern=TRUE))

