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(173558,173820,171663,174110,174338,175440,174922,172188,171330,169560,174579,173740,173427,172952,170305,172717,173019,173690,172439,171914,171968,169500,173898,172308,171568,164939,161275,160770,162466,160185,154836,154103,150495,142707,149962,149967,144572,143819,141070,144119,145330,143279,139063,139202,133632,134476,141859,140693,138047,138346,140167,146796,152228,155410,159032,160312,157687,160141,167421,167628,164403) > x <- c(210944,218238,212696,214774,212248,212055,210783,206482,206037,207351,215248,214080,213840,207623,202097,204023,204776,202436,198365,196066,195898,196621,205523,206211,200855,190133,183418,182122,181712,177421,172267,169850,166037,163600,177263,179606,169189,164017,159004,160079,160792,157135,153070,151414,146612,150703,163627,165264,155839,151095,148609,152353,154304,154504,154436,154589,151473,156009,169123,171568,162335) > 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 -840.96276 2 -4238.34551 3 -3614.93706 4 -2210.46481 5 -715.17651 6 483.65114 7 603.81057 8 27.61222 9 -607.13232 10 -3036.36305 11 -1979.26950 12 -2232.28663 13 -2424.87919 14 219.17518 15 344.55647 16 1790.28677 17 1714.50843 18 3559.48096 19 4350.89215 20 4979.29508 21 5117.58029 22 2286.85288 23 2218.74028 24 283.57228 25 2230.66497 26 980.86732 27 685.76713 28 830.96730 29 2732.66334 30 2604.44801 31 -158.80223 32 320.80102 33 -1374.22578 34 -7939.58858 35 -7539.28375 36 -8709.76138 37 -8878.57682 38 -7036.79650 39 -7270.78612 40 -4761.11111 41 -3907.82154 42 -4124.11319 43 -6300.71218 44 -5330.90085 45 -8491.74867 46 -9700.19381 47 -8801.13442 48 -10788.41349 49 -8705.91301 50 -6026.85930 51 -2958.63891 52 1792.00504 53 6245.19290 54 9326.85337 55 12982.96881 56 14186.20907 57 13124.49899 58 13302.79838 59 14003.53523 60 12983.88444 61 14391.05897 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/11y3q1257264967.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/2eu2c1257264967.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/3sts31257264967.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/4y4si1257264967.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/58o3j1257264967.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/6o1fp1257264967.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/7u28w1257264967.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/84b2d1257264967.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. 146600 159000 177400 181200 205500 218200 > > #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/96z421257264967.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/10chhp1257264967.tab") > > system("convert tmp/11y3q1257264967.ps tmp/11y3q1257264967.png") > system("convert tmp/2eu2c1257264967.ps tmp/2eu2c1257264967.png") > system("convert tmp/3sts31257264967.ps tmp/3sts31257264967.png") > system("convert tmp/4y4si1257264967.ps tmp/4y4si1257264967.png") > system("convert tmp/58o3j1257264967.ps tmp/58o3j1257264967.png") > system("convert tmp/6o1fp1257264967.ps tmp/6o1fp1257264967.png") > system("convert tmp/7u28w1257264967.ps tmp/7u28w1257264967.png") > system("convert tmp/84b2d1257264967.ps tmp/84b2d1257264967.png") > > > proc.time() user system elapsed 1.626 1.217 7.275