x <- c(13,16,19,15,14,13,19,15,14,15,16,16,16,16,17,15,15,20,18,16,16,16,19,16,17,17,16,15,16,14,15,12,14,16,14,7,10,14,16,16,16,14,20,14,14,11,14,15,16,14,16,14,12,16,9,14,16,16,15,16,12,16,16,14,16,17,18,18,12,16,10,14,18,18,16,17,16,16,13,16,16,20,16,15,15,16,14,16,16,15,12,17,16,15,13,16,16,16,16,14,16,16,20,15,16,13,17,16,16,12,16,16,17,13,12,18,14,14,13,16,13,16,13,16,15,16,15,17,15,12,16,10,16,12,14,15,13,15,11,12,8,16,15,17,16,10,18,13,16,13,10,15,16,16,14,10,17,13,15,16,12,13) par2 = '36' par1 = '0' par2 <- '36' par1 <- '0' #'GNU S' R Code compiled by R2WASP v. 1.2.291 () #Author: root #To cite this work: Wessa P., (2012), Univariate Explorative Data Analysis (v1.0.9) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_edauni.wasp/ #Source of accompanying publication: Office for Research, Development, and Education # par1 <- as.numeric(par1) par2 <- as.numeric(par2) x <- as.ts(x) library(lattice) postscript(file="/var/wessaorg/rcomp/tmp/1nvk31352116812.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) plot(x,type='l',main='Run Sequence Plot',xlab='time or index',ylab='value') grid() dev.off() postscript(file="/var/wessaorg/rcomp/tmp/2qlh21352116812.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) hist(x) grid() dev.off() postscript(file="/var/wessaorg/rcomp/tmp/3qe9l1352116812.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) if (par1 > 0) { densityplot(~x,col='black',main=paste('Density Plot bw = ',par1),bw=par1) } else { densityplot(~x,col='black',main='Density Plot') } dev.off() postscript(file="/var/wessaorg/rcomp/tmp/4tcgm1352116813.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) qqnorm(x) qqline(x) grid() dev.off() if (par2 > 0) { postscript(file="/var/wessaorg/rcomp/tmp/5g9df1352116813.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) dum <- cbind(lag(x,k=1),x) dum dum1 <- dum[2:length(x),] dum1 z <- as.data.frame(dum1) z plot(z,main='Lag plot (k=1), lowess, and regression line') lines(lowess(z)) abline(lm(z)) dev.off() if (par2 > 1) { postscript(file="/var/wessaorg/rcomp/tmp/6dh2i1352116813.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) dum <- cbind(lag(x,k=par2),x) dum dum1 <- dum[(par2+1):length(x),] dum1 z <- as.data.frame(dum1) z mylagtitle <- 'Lag plot (k=' mylagtitle <- paste(mylagtitle,par2,sep='') mylagtitle <- paste(mylagtitle,'), and lowess',sep='') plot(z,main=mylagtitle) lines(lowess(z)) dev.off() } postscript(file="/var/wessaorg/rcomp/tmp/7rzrm1352116813.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) acf(x,lag.max=par2,main='Autocorrelation Function') grid() dev.off() } summary(x) #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab load(file="/var/wessaorg/rcomp/createtable") a<-table.start() a<-table.row.start(a) a<-table.element(a,'Descriptive Statistics',2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'# observations',header=TRUE) a<-table.element(a,length(x)) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'minimum',header=TRUE) a<-table.element(a,min(x)) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'Q1',header=TRUE) a<-table.element(a,quantile(x,0.25)) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'median',header=TRUE) a<-table.element(a,median(x)) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'mean',header=TRUE) a<-table.element(a,mean(x)) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'Q3',header=TRUE) a<-table.element(a,quantile(x,0.75)) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'maximum',header=TRUE) a<-table.element(a,max(x)) a<-table.row.end(a) a<-table.end(a) table.save(a,file="/var/wessaorg/rcomp/tmp/8v7da1352116813.tab") try(system("convert tmp/1nvk31352116812.ps tmp/1nvk31352116812.png",intern=TRUE)) try(system("convert tmp/2qlh21352116812.ps tmp/2qlh21352116812.png",intern=TRUE)) try(system("convert tmp/3qe9l1352116812.ps tmp/3qe9l1352116812.png",intern=TRUE)) try(system("convert tmp/4tcgm1352116813.ps tmp/4tcgm1352116813.png",intern=TRUE)) try(system("convert tmp/5g9df1352116813.ps tmp/5g9df1352116813.png",intern=TRUE)) try(system("convert tmp/6dh2i1352116813.ps tmp/6dh2i1352116813.png",intern=TRUE)) try(system("convert tmp/7rzrm1352116813.ps tmp/7rzrm1352116813.png",intern=TRUE))