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(13132.1,17665.9,16913,17318.8,16224.2,15469.6,16557.5,19414.8,17335,16525.2,18160.4,15553.8,15262.2,18581,17564.1,18948.6,17187.8,17564.8,17668.4,20811.7,17257.8,18984.2,20532.6,17082.3,16894.9,20274.9,20078.6,19900.9,17012.2,19642.9,19024,21691,18835.9,19873.4,21468.2,19406.8,18385.3,20739.3,22268.3,21569,17514.8,21124.7,21251,21393,22145.2,20310.5,23466.9,21264.6,18388.1,22635.4,22014.3,18422.7,16120.2,16037.7,16410.7,17749.8,16349.8,15662.3,17782.3,16398.9) > x <- c(12002.4,15525.5,14247.9,15000.7,14931.4,13333.7,14711.2,17197.3,14985.2,14734.4,15937.8,13028.1,13836.8,16677.5,15130,17504,16979.9,16012.5,16247.7,19268.2,15533,16803.3,17396.1,15155.4,15692.4,18063.7,17568.6,18154.3,15467.4,16956.1,16854,19396.4,16457.6,17284.5,18395.3,16938.7,16414.3,18173.4,19919.7,19623.8,17228.1,18730.3,19039.1,19413.3,20013.6,17917.2,21270.3,18766.1,16790.8,19960.6,19586.7,17179,14964.9,13918.5,14401.3,15994.6,14521.1,13746.5,15956,14332.2) > 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 -563.86833 2 213.67831 3 822.92792 4 426.10877 5 -594.60506 6 354.22828 7 -26.53256 8 180.14115 9 458.83454 10 -83.56790 11 268.59293 12 764.25242 13 -389.56611 14 -99.45928 15 533.55190 16 -613.05578 17 -1815.07165 18 -406.65060 19 -553.81577 20 -630.90783 21 -202.41802 22 169.61547 23 1085.98487 24 24.67097 25 -735.26687 26 116.50413 27 448.06909 28 -354.09164 29 -378.07672 30 665.40340 31 155.36022 32 111.70809 33 389.89337 34 545.77039 35 956.25935 36 447.85491 37 -14.54111 38 463.94435 39 131.07690 40 -252.74090 41 -1752.69714 42 255.58956 43 52.65365 44 -204.31033 45 -92.13726 46 308.29928 47 -110.30374 48 357.32038 49 -413.15730 50 454.57020 51 232.11433 52 -792.44778 53 -734.32204 54 298.82711 55 157.07615 56 -202.56600 57 -31.55203 58 106.80981 59 -128.91152 60 218.94908 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1oout1256672633.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/20hh01256672633.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/3aooa1256672633.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/4uafm1256672633.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/55oq61256672633.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/6sgxp1256672633.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/7omo71256672633.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/8crwr1256672633.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. 12000 15000 16730 16620 18090 21270 > > #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/9pcod1256672633.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/10zryk1256672633.tab") > > system("convert tmp/1oout1256672633.ps tmp/1oout1256672633.png") > system("convert tmp/20hh01256672633.ps tmp/20hh01256672633.png") > system("convert tmp/3aooa1256672633.ps tmp/3aooa1256672633.png") > system("convert tmp/4uafm1256672633.ps tmp/4uafm1256672633.png") > system("convert tmp/55oq61256672633.ps tmp/55oq61256672633.png") > system("convert tmp/6sgxp1256672633.ps tmp/6sgxp1256672633.png") > system("convert tmp/7omo71256672633.ps tmp/7omo71256672633.png") > system("convert tmp/8crwr1256672633.ps tmp/8crwr1256672633.png") > > > proc.time() user system elapsed 1.559 1.179 2.320