R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(9769.3456,9901.245025,10034.0289,9769.3456,10304.2801,10436.6656,10483.7121,10514.4516,10578.1225,10706.0409,10726.7449,10751.6161,10712.25,10706.0409,10701.9025,10708.1104,10801.4449,10793.1321,10899.36,10980.9441,10976.7529,11052.3169,11079.6676,11016.6016,10972.5625,11027.1001,11056.5225,11067.04,11187.2929,11189.4084,11291.1876,11263.5769,11261.4544,11357.1649,11329.4736,11350.7716,11470.41,11685.61,11750.56,11846.1456,12016.5444,12192.5764,12247.8489,12467.9556,12606.7984,12739.6369,12584.3524,12624.7696,12579.8656,12430.0201,12376.5625,12401.0496,12485.8276,12343.21,12394.3689,12376.5625,12329.8816,12314.3409,12389.9161,12325.4404) > x <- c(23531.56,21025,18961.29,21992.89,23164.84,28696.36,28425.96,25953.21,30310.81,32041,36328.36,36100,32978.56,30555.04,32580.25,38730.24,37558.44,38809,46785.69,49017.96,47480.41,52762.09,51710.76,41697.64,38651.56,39521.44,43056.25,36366.49,40642.56,44310.25,49952.25,50086.44,53453.44,59536,55084.09,62600.04,70596.49,82713.76,80258.89,87261.16,97531.29,111422.44,120895.29,146842.24,165730.41,171064.96,131551.29,103619.61,57312.36,36481,25504.09,26699.56,24837.76,27622.44,31222.89,39322.89,51166.44,46742.44,55648.81,51483.61) > 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 -1201.215334 2 -1034.422554 3 -872.910158 4 -1179.795796 5 -661.175793 6 -605.793551 7 -554.982863 8 -489.820671 9 -486.811108 10 -382.978360 11 -421.957899 12 -393.907742 13 -389.820858 14 -362.292588 15 -394.623559 16 -474.028522 17 -364.381613 18 -390.103226 19 -394.917339 20 -344.408253 21 -327.195506 22 -325.156788 23 -283.170719 24 -206.845944 25 -208.481133 26 -166.052970 27 -185.838000 28 -82.193600 29 -21.467072 30 -70.408800 31 -47.170830 32 -76.649564 33 -125.643443 34 -114.607126 35 -80.324217 36 -163.654355 37 -155.333043 38 -108.815298 39 -9.691511 40 -11.583205 41 15.847031 42 -1.497076 43 -78.094354 44 -219.190304 45 -343.286195 46 -284.708970 47 110.068958 48 539.317864 49 1139.048452 50 1279.192428 51 1378.542344 52 1386.387529 53 1497.083300 54 1315.700689 55 1316.738396 56 1186.173408 57 974.620658 58 1020.665636 59 972.256921 60 965.764193 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1e1sr1257266446.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/html/rcomp/tmp/206dp1257266446.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/html/rcomp/tmp/3g59i1257266446.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/html/rcomp/tmp/4t6gb1257266446.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/html/rcomp/tmp/56teu1257266446.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/html/rcomp/tmp/6hof31257266446.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/html/rcomp/tmp/7oh111257266446.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/html/rcomp/tmp/8dmut1257266446.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. 18960 31840 42380 54070 56060 171100 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/html/rcomp/tmp/92h281257266446.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/html/rcomp/tmp/10hpf91257266446.tab") > > system("convert tmp/1e1sr1257266446.ps tmp/1e1sr1257266446.png") > system("convert tmp/206dp1257266446.ps tmp/206dp1257266446.png") > system("convert tmp/3g59i1257266446.ps tmp/3g59i1257266446.png") > system("convert tmp/4t6gb1257266446.ps tmp/4t6gb1257266446.png") > system("convert tmp/56teu1257266446.ps tmp/56teu1257266446.png") > system("convert tmp/6hof31257266446.ps tmp/6hof31257266446.png") > system("convert tmp/7oh111257266446.ps tmp/7oh111257266446.png") > system("convert tmp/8dmut1257266446.ps tmp/8dmut1257266446.png") > > > proc.time() user system elapsed 1.578 1.173 2.326