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(-81910.3318,-93644.08509,-89140.3318,-94274.08509,-93293.83839,-95108.59168,-99272.83839,-106723.3318,-109204.8384,-97893.3318,-106911.8252,-119008.0719,-84134.31862,-87412.56533,-87010.07192,-88119.57851,-99073.57851,-102284.3186,-105249.3186,-114141.3186,-108619.8252,-102469.8384,-113002.8252,-122149.8252,-89971.57851,-96598.83839,-91900.09827,-96628.57851,-103041.812,-100207.5653,-105075.5653,-111519.0719,-106051.8252,-97938.82521,-110221.5785,-114085.8252,-93076.82521,-90442.07192,-79053.3318,-86755.34497,-100976.6049,-96577.09827,-108972.6049,-110511.3713,-106556.1246,-101241.1378,-106677.6312,-115294.8779,-88983.86474,-94813.37133,-87843.13779,-91750.90426,-98579.15097,-90683.67073,-107493.9306,-106861.9306,-104577.4372,-103179.1905,-104578.424,-119324.4109) > x <- c(-140413.1318,-140403.8851,-140412.7318,-140403.4851,-140393.6384,-140384.2917,-140393.4384,-140411.4318,-140392.6384,-140411.0318,-140429.5252,-140438.6719,-140447.7686,-140456.6953,-140437.7019,-140419.1985,-140419.6585,-140447.2886,-140447.1786,-140447.0186,-140428.1852,-140391.1784,-140427.7852,-140427.7952,-140418.5485,-140390.2984,-140362.3483,-140417.7485,-140464.162,-140454.7453,-140454.6153,-140435.9519,-140426.6752,-140426.6252,-140417.5885,-140426.6852,-140426.6852,-140435.2619,-140407.3618,-140370.355,-140343.8749,-140362.2883,-140343.5849,-140297.1913,-140287.9146,-140250.8878,-140269.2712,-140278.3679,-140315.2247,-140296.4213,-140249.9578,-140203.7143,-140212.461,-140156.9707,-140129.1006,-140129.1606,-140110.7072,-140101.1805,-140147.564,-140184.3709) > 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 17822.5980 2 6184.5537 3 10596.7382 4 5558.6940 5 6640.8601 6 4922.8509 7 663.9302 8 -6972.8060 9 -9259.7893 10 1861.3343 11 -7348.5772 12 -19539.4979 13 15240.0989 14 11869.4553 15 12468.5421 16 11550.5572 17 591.7959 18 -2904.9328 19 -5868.7942 20 -14759.1381 21 -9042.7074 22 -2509.6774 23 -13421.5672 24 -22568.6707 25 9705.2851 26 3370.4312 27 8358.4721 28 3056.5656 29 -3837.0763 30 -905.3610 31 -5772.0154 32 -12022.3443 33 -6459.0780 34 1654.4395 35 -10534.7783 36 -14493.1815 37 6515.8185 38 9061.7976 39 20739.3210 40 13420.3511 41 -526.8234 42 3682.0931 43 -8519.8218 44 -9578.3857 45 -5527.1195 46 171.1176 47 -5455.6554 48 -14167.0585 49 11762.4640 50 6127.5842 51 13578.7437 52 10149.6260 53 3230.8455 54 11700.6847 55 -4821.1025 56 -4189.7235 57 -1714.2260 58 -217.3721 59 -2096.7035 60 -17223.6645 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1iucu1257330756.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/25byo1257330756.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/3do1j1257330756.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/42w2t1257330756.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/5vd2u1257330756.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/6vy871257330756.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/7eu731257330756.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/8ldjc1257330756.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. -140500 -140400 -140400 -140400 -140300 -140100 > > #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/9pyg31257330756.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/10bf0n1257330756.tab") > > system("convert tmp/1iucu1257330756.ps tmp/1iucu1257330756.png") > system("convert tmp/25byo1257330756.ps tmp/25byo1257330756.png") > system("convert tmp/3do1j1257330756.ps tmp/3do1j1257330756.png") > system("convert tmp/42w2t1257330756.ps tmp/42w2t1257330756.png") > system("convert tmp/5vd2u1257330756.ps tmp/5vd2u1257330756.png") > system("convert tmp/6vy871257330756.ps tmp/6vy871257330756.png") > system("convert tmp/7eu731257330756.ps tmp/7eu731257330756.png") > system("convert tmp/8ldjc1257330756.ps tmp/8ldjc1257330756.png") > > > proc.time() user system elapsed 1.600 1.186 5.667