source('/home/pw/wessanet/cretab')



myrfcuid = 'r0627145'

x <- c(3035,2552,2704,2554,2014,1655,1721,1524,1596,2074,2199,2512,2933,2889,2938,2497,1870,1726,1607,1545,1396,1787,2076,2837,2787,3891,3179,2011,1636,1580,1489,1300,1356,1653,2013,2823,3102,2294,2385,2444,1748,1554,1498,1361,1346,1564,1640,2293,2815,3137,2679,1969,1870,1633,1529,1366,1357,1570,1535,2491,3084,2605,2573,2143,1693,1504,1461,1354,1333,1492,1781,1915)
par1 = '12'
par1 <- '12'
#'GNU S' R Code compiled by R2WASP v. 1.2.327 (Tue, 16 Aug 2016 15:30:13 +0200)
#Author: root
#To cite this work: Wessa P., (2015), Variance Reduction Matrix (v1.0.5) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_variancereduction.wasp/
#Source of accompanying publication: 
#
par1 <- as.numeric(par1)
n.orig <- length(x)
x <- na.omit(x)
n <- length(x)
sx <- sort(x)

a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Variance Reduction Matrix',6,TRUE)
a<-table.row.end(a)
if(n.orig!=n) {
a<-table.row.start(a)
a<-table.element(a,'Warning: NAs were removed from the time series! The results shown below will only be correct if the NAs are all located at the start and/or end of the time series.',6,F)
a<-table.row.end(a)
}
for (bigd in 0:2) {
for (smalld in 0:3) {
mylabel <- 'V(Y[t],d='
mylabel <- paste(mylabel,as.character(smalld),sep='')
mylabel <- paste(mylabel,',D=',sep='')
mylabel <- paste(mylabel,as.character(bigd),sep='')
mylabel <- paste(mylabel,')',sep='')
a<-table.row.start(a)
a<-table.element(a,mylabel,header=TRUE)
myx <- x
if (smalld > 0) myx <- diff(myx,lag=1,differences=smalld)
if (bigd > 0) myx <- diff(myx,lag=par1,differences=bigd)
a<-table.element(a,signif(var(myx), digits=6))
a<-table.element(a,'Range',header=TRUE)
a<-table.element(a,signif(max(myx)-min(myx), digits=6))
a<-table.element(a,'Trim Var.',header=TRUE)
smyx <- sort(myx)
sn <- length(smyx)
a<-table.element(a,signif(var(smyx[smyx>quantile(smyx,0.05) & smyx<quantile(smyx,0.95)]), digits=6))
a<-table.row.end(a)
}
}
a<-table.end(a)
table.save(a,file="/home/pw/wessanet/rcomp/tmp/1es2y1485337672.tab") 
postscript(file="/home/pw/wessanet/rcomp/tmp/29n5v1485337672.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
op <- par(mfrow=c(2,2))
plot(x,type='l',xlab='time',ylab='value',main='d=0, D=0')
plot(diff(x,lag=1,differences=1),type='l',xlab='time',ylab='value',main='d=1, D=0')
plot(diff(x,lag=par1,differences=1),type='l',xlab='time',ylab='value',main='d=0, D=1')
plot(diff(diff(x,lag=1,differences=1),lag=par1,differences=1),type='l',xlab='time',ylab='value',main='d=1, D=1')
par(op)
dev.off()

try(system("convert /home/pw/wessanet/rcomp/tmp/29n5v1485337672.ps /home/pw/wessanet/rcomp/tmp/29n5v1485337672.png",intern=TRUE))
