R version 2.8.1 (2008-12-22) 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. > y <- c(2.08,2.12,2.14,2.13,2.10,2.09,2.10,2.09,2.08,2.07,2.08,2.09,2.11,2.20,2.42,2.46,2.50,2.59,2.75,2.78,2.90,3.03,3.10,3.23,3.36,3.51,3.61,3.67,3.74,3.82,3.89,3.98,4.08,4.14,4.33,4.57,4.63,4.57,4.71,4.54,4.30,4.36,4.61,4.71,4.68,4.91,4.75,4.77,5.18,3.42,2.71,2.29,2.00,1.64,1.30,1.08,1.00,1.00,1.00,1.00) > x <- c(0.800641,0.769764,0.745823,0.762253,0.768403,0.757518,0.772917,0.787774,0.822030,0.830772,0.813537,0.815927,0.832293,0.848464,0.843455,0.826241,0.837661,0.831947,0.814930,0.783085,0.790514,0.788395,0.780579,0.785731,0.792959,0.776337,0.756830,0.769290,0.764877,0.755173,0.739864,0.740138,0.745212,0.729076,0.734107,0.719632,0.702889,0.681013,0.686342,0.679440,0.678058,0.644039,0.634880,0.642797,0.642963,0.634115,0.667780,0.695894,0.750638,0.785423,0.743550,0.755344,0.782167,0.766284,0.758150,0.732601,0.713470,0.709824,0.700869,0.700869) > par2 = '36' > par1 = '0' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: > par1 <- as.numeric(par1) > par2 <- as.numeric(par2) > x <- as.ts(x) > y <- as.ts(y) > mylm <- lm(y~x) > cbind(mylm$resid) [,1] 1 -0.42360072 2 -0.73193300 3 -0.98201827 4 -0.80666674 5 -0.76728683 6 -0.90008363 7 -0.71636310 8 -0.55875703 9 -0.18230529 10 -0.09368429 11 -0.27811725 12 -0.24115498 13 -0.03652545 14 0.23590423 15 0.39939627 16 0.24520021 17 0.41403250 18 0.43957123 19 0.40759758 20 0.07834502 21 0.28215369 22 0.38824865 23 0.37007411 24 0.55819530 25 0.76973644 26 0.73221890 27 0.61215485 28 0.81271967 29 0.83293536 30 0.80346175 31 0.70075654 32 0.79384762 33 0.95108886 34 0.82905403 35 1.07581018 36 1.15251356 37 1.02363098 38 0.71684157 39 0.91695954 40 0.66909610 41 0.41350536 42 0.08972729 43 0.23640199 44 0.42571593 45 0.39758862 46 0.52777180 47 0.74755630 48 1.08471839 49 2.11230112 50 0.74472066 51 -0.43766064 52 -0.72460915 53 -0.71201120 54 -1.25119187 55 -1.68295386 56 -2.19117944 57 -2.48700173 58 -2.52813330 59 -2.62915721 60 -2.62915721 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1bdd31256758056.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(y,type='l',main='Run Sequence Plot of Y[t]',xlab='time or index',ylab='value') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/2kbm01256758056.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,type='l',main='Run Sequence Plot of X[t]',xlab='time or index',ylab='value') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/35lsj1256758056.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y,main='Scatter Plot',xlab='X[t]',ylab='Y[t]') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/4jdg31256758056.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mylm$resid,type='l',main='Run Sequence Plot of e[t]',xlab='time or index',ylab='value') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/5t85y1256758056.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mylm$resid,main='Histogram of e[t]') > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6f1zw1256758056.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if (par1 > 0) + { + densityplot(~mylm$resid,col='black',main=paste('Density Plot of e[t] bw = ',par1),bw=par1) + } else { + densityplot(~mylm$resid,col='black',main='Density Plot of e[t]') + } > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/7g43n1256758056.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mylm$resid,main='QQ plot of e[t]') > qqline(mylm$resid) > grid() > dev.off() null device 1 > if (par2 > 0) + { + postscript(file="/var/www/rcomp/tmp/8qpwv1256758057.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + acf(mylm$resid,lag.max=par2,main='Residual Autocorrelation Function') + grid() + dev.off() + } null device 1 > summary(x) Min. 1st Qu. Median Mean 3rd Qu. Max. 0.6341 0.7126 0.7578 0.7521 0.7879 0.8485 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Model: Y[t] = c + b X[t] + e[t]',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'c',1,TRUE) > a<-table.element(a,mylm$coeff[[1]]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'b',1,TRUE) > a<-table.element(a,mylm$coeff[[2]]) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/96yj51256758057.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Descriptive Statistics about e[t]',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'# observations',header=TRUE) > a<-table.element(a,length(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'minimum',header=TRUE) > a<-table.element(a,min(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Q1',header=TRUE) > a<-table.element(a,quantile(mylm$resid,0.25)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'median',header=TRUE) > a<-table.element(a,median(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'mean',header=TRUE) > a<-table.element(a,mean(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Q3',header=TRUE) > a<-table.element(a,quantile(mylm$resid,0.75)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'maximum',header=TRUE) > a<-table.element(a,max(mylm$resid)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/10a7291256758057.tab") > > system("convert tmp/1bdd31256758056.ps tmp/1bdd31256758056.png") > system("convert tmp/2kbm01256758056.ps tmp/2kbm01256758056.png") > system("convert tmp/35lsj1256758056.ps tmp/35lsj1256758056.png") > system("convert tmp/4jdg31256758056.ps tmp/4jdg31256758056.png") > system("convert tmp/5t85y1256758056.ps tmp/5t85y1256758056.png") > system("convert tmp/6f1zw1256758056.ps tmp/6f1zw1256758056.png") > system("convert tmp/7g43n1256758056.ps tmp/7g43n1256758056.png") > system("convert tmp/8qpwv1256758057.ps tmp/8qpwv1256758057.png") > > > proc.time() user system elapsed 1.710 1.530 3.202