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(10723.8,13938.9,13979.8,13807.4,12973.9,12509.8,12934.1,14908.3,13772.1,13012.6,14049.9,11816.5,11593.2,14466.2,13615.9,14733.9,13880.7,13527.5,13584,16170.2,13260.6,14741.9,15486.5,13154.5,12621.2,15031.6,15452.4,15428,13105.9,14716.8,14180,16202.2,14392.4,15140.6,15960.1,14351.3,13230.2,15202.1,17056,16077.7,13348.2,16402.4,16559.1,16579,17561.2,16129.6,18484.3,16402.6,14032.3,17109.1,17157.2,13879.8,12362.4,12683.5,12608.8,13583.7,12846.3,12347.1,13967,13114.3) > x <- c(10414.9,12476.8,12384.6,12266.7,12919.9,11497.3,12142,13919.4,12656.8,12034.1,13199.7,10881.3,11301.2,13643.9,12517,13981.1,14275.7,13435,13565.7,16216.3,12970,14079.9,14235,12213.4,12581,14130.4,14210.8,14378.5,13142.8,13714.7,13621.9,15379.8,13306.3,14391.2,14909.9,14025.4,12951.2,14344.3,16093.4,15413.6,14705.7,15972.8,16241.4,16626.4,17136.2,15622.9,18003.9,16136.1,14423.7,16789.4,16782.2,14133.8,12607,12004.5,12175.4,13268,12299.3,11800.6,13873.3,12269.6) > 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 -493.553080 2 810.329564 3 936.691633 4 873.575559 5 -565.388904 6 289.148183 7 115.862544 8 442.554068 9 476.683876 10 294.377265 11 251.258743 12 166.831204 13 -445.682709 14 255.820662 15 450.067361 16 210.963073 17 -915.307703 18 -489.245648 19 -553.894156 20 -424.589603 21 -325.127621 22 127.383329 23 728.217961 24 270.080421 25 -603.955551 26 370.273844 27 716.549437 28 536.704871 29 -639.999481 30 440.794692 31 -9.987087 32 382.779386 33 494.949019 34 237.532981 35 576.239324 36 -212.699504 37 -338.101515 38 342.505552 39 575.128925 40 226.949474 41 -1846.383513 42 33.315536 43 -58.955307 44 -395.919695 45 113.736240 46 84.845015 47 232.547332 48 -117.850579 49 -900.891935 50 -16.907735 51 37.866093 52 -784.677685 53 -886.855483 54 -7.285889 55 -240.396600 56 -278.249926 57 -117.742049 58 -154.686801 59 -456.014898 60 177.787490 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/13ka91258220809.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/2lut51258220809.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/3xdam1258220809.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/4aaz51258220809.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/5aaut1258220809.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/6299u1258220809.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/7pjde1258220809.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/8cxy91258220809.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. 10410 12510 13680 13810 14490 18000 > > #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/9drlz1258220809.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/10m8oz1258220809.tab") > > system("convert tmp/13ka91258220809.ps tmp/13ka91258220809.png") > system("convert tmp/2lut51258220809.ps tmp/2lut51258220809.png") > system("convert tmp/3xdam1258220809.ps tmp/3xdam1258220809.png") > system("convert tmp/4aaz51258220809.ps tmp/4aaz51258220809.png") > system("convert tmp/5aaut1258220809.ps tmp/5aaut1258220809.png") > system("convert tmp/6299u1258220809.ps tmp/6299u1258220809.png") > system("convert tmp/7pjde1258220809.ps tmp/7pjde1258220809.png") > system("convert tmp/8cxy91258220809.ps tmp/8cxy91258220809.png") > > > proc.time() user system elapsed 1.628 1.157 2.486