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(12034.09,9820.81,7516.89,12409.96,6146.56,5882.89,13041.64,9940.09,8873.64,30102.25,6905.61,7903.21,17424,14908.41,11046.01,17875.69,4044.96,12701.29,14520.25,12544,15926.44,43764.64,8281,13618.89,18933.76,11685.61,18659.56,23195.29,13064.49,14568.49,17371.24,16744.36,35156.25,35910.25,11924.64,24995.61,31046.44,15750.25,24025,29002.09,9880.36,19376.64,28764.16,18523.21,28291.24,101505.96,23746.81,26049.96,33635.56,27655.69,41209,30485.16,15450.49,23839.36,29070.25,28696.36,29275.21,83636.64,21199.36,18063.36,28291.24) > x <- c(13363.36,12387.69,13133.16,18906.25,7005.69,11236,15227.56,16002.25,14400,20050.56,8190.25,9312.25,12882.25,14424.01,15351.21,20851.36,8244.64,13041.64,19071.61,18225,17239.69,20909.16,10342.89,11815.69,18306.09,15450.49,19126.89,25027.24,8742.25,15575.04,23839.36,23347.84,22171.21,29002.09,15575.04,18063.36,23716,21874.41,28257.61,30870.49,13618.89,19824.64,26961.64,30206.44,28156.84,27755.56,18252.01,24995.61,23043.24,27788.89,27324.09,34969,15675.04,20851.36,33014.89,30940.81,27655.69,32942.25,14835.24,18171.04,26536.41) > 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 -294.4444 2 -1068.0504 3 -4471.9671 4 -8097.5229 5 3199.2429 6 -3306.5657 7 -2037.6609 8 -6282.3239 9 -4984.5342 10 7906.2522 11 2210.3860 12 1552.3912 13 5805.3793 14 1014.8072 15 -4215.7457 16 -5501.9481 17 -730.5205 18 847.4775 19 -6231.2339 20 -6958.2476 21 -2121.9091 22 20301.7137 23 409.3948 24 3574.0583 25 -688.1420 26 -3722.6407 27 -2173.4937 28 -6344.1711 29 7554.7488 30 -1023.5436 31 -10415.4154 32 -10317.0209 33 9831.0746 34 505.6006 35 -3667.3936 36 5731.8743 37 3441.8115 38 -9136.9748 39 -10281.1135 40 -9159.5233 41 -2825.2280 42 -2485.9960 43 -3629.6529 44 -18658.5479 45 -5866.1799 46 67940.6588 47 4204.7071 48 -3442.8287 49 7023.6391 50 -5958.7921 51 8280.3650 52 -13724.1111 53 -289.1010 54 461.7219 55 -12255.5857 56 -9569.0157 57 -4142.7256 58 42417.9900 59 6698.9566 60 -1359.2656 61 -3475.1143 > library(lattice) > postscript(file="/var/www/rcomp/tmp/17hbj1256757012.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/26gy41256757012.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/3flou1256757012.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/4vqhc1256757012.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/50d8i1256757012.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/6wgpm1256757012.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/7wfl21256757012.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/8zj8a1256757012.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. 7006 14420 18910 19740 25030 34970 > > #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/9w0ol1256757012.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/100ic11256757012.tab") > > system("convert tmp/17hbj1256757012.ps tmp/17hbj1256757012.png") > system("convert tmp/26gy41256757012.ps tmp/26gy41256757012.png") > system("convert tmp/3flou1256757012.ps tmp/3flou1256757012.png") > system("convert tmp/4vqhc1256757012.ps tmp/4vqhc1256757012.png") > system("convert tmp/50d8i1256757012.ps tmp/50d8i1256757012.png") > system("convert tmp/6wgpm1256757012.ps tmp/6wgpm1256757012.png") > system("convert tmp/7wfl21256757012.ps tmp/7wfl21256757012.png") > system("convert tmp/8zj8a1256757012.ps tmp/8zj8a1256757012.png") > > > proc.time() user system elapsed 1.88 1.80 3.25