R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(63756.25,63051.21,65076.01,66718.89,65178.09,68173.21,64414.44,63958.41,64465.21,65280.25,68644,69063.84,69326.89,68906.25,72468.64,73332.64,75130.81,74529,71449.29,71342.41,71931.24,73008.04,73712.25,78961,78456.01,79242.25,81738.81,83984.04,85790.41,84797.44,85147.24,83984.04,85556.25,84274.09,88506.25,94556.25,92842.09,92781.16,96534.49,96534.49,99666.49,99036.09,97468.84,97843.84,98784.49,102208.09,102336.01,108570.25,106863.61,108702.09,112694.49,113703.84,115396.09,114446.89,115056.64,117306.25,117100.84,114446.89,114921,119646.81) > x <- c(6.76,6.25,6.25,2.56,1.96,0.64,1.21,1.69,1.44,1.69,1.21,1.69,1.44,2.56,2.89,2.25,0.81,2.25,1.96,2.56,2.89,1.96,3.24,2.89,1.96,1.44,1,2.89,5.76,4,4.41,4,3.24,7.29,5.29,3.61,4,5.29,7.84,5.76,5.29,7.29,7.29,8.41,9,4.84,5.29,7.84,7.84,7.84,4.84,6.76,7.84,6.25,5.76,5.29,3.61,2.89,4,4.41) > 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 -35445.8857 2 -33771.6809 3 -31746.8809 4 -12889.4647 5 -11631.1531 6 -2477.9876 7 -8895.9136 8 -11591.2329 9 -9918.1364 10 -10269.3929 11 -4666.3536 12 -6485.8029 13 -5056.4564 14 -10702.1047 15 -8679.2260 16 -4829.5070 17 3686.5308 18 -3633.1470 19 -5359.9531 20 -8265.9447 21 -9216.6260 22 -3801.2031 23 -9068.4311 24 -2186.8660 25 1646.7669 26 4858.9036 27 9408.1454 28 2836.1740 29 -8746.5398 30 -1528.7825 31 -3091.7087 32 -2342.1825 33 2775.5689 34 -17400.5943 35 -3838.0624 36 10049.4501 37 6515.8675 38 436.8476 39 -7706.0466 40 1997.5402 41 7322.1776 42 -2638.5943 43 -4205.8443 44 -9055.8526 45 -10867.6623 46 11963.1113 47 9991.6976 48 4329.7134 49 2623.0734 50 4461.5534 51 22449.5113 52 14501.7043 53 11155.5534 54 17623.9991 55 20519.6902 56 24961.9376 57 32594.0401 58 33299.0240 59 28594.7775 60 31407.8613 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/17a1o1256751253.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/freestat/rcomp/tmp/27vam1256751253.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/freestat/rcomp/tmp/3vrlz1256751253.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/freestat/rcomp/tmp/4mxkh1256751253.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/freestat/rcomp/tmp/50a3k1256751253.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/freestat/rcomp/tmp/6no631256751253.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/freestat/rcomp/tmp/7lfcs1256751253.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/freestat/rcomp/tmp/8vu2y1256751253.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. 0.640 2.178 4.000 4.190 5.882 9.000 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9e5i51256751253.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/freestat/rcomp/tmp/100jvx1256751253.tab") > > system("convert tmp/17a1o1256751253.ps tmp/17a1o1256751253.png") > system("convert tmp/27vam1256751253.ps tmp/27vam1256751253.png") > system("convert tmp/3vrlz1256751253.ps tmp/3vrlz1256751253.png") > system("convert tmp/4mxkh1256751253.ps tmp/4mxkh1256751253.png") > system("convert tmp/50a3k1256751253.ps tmp/50a3k1256751253.png") > system("convert tmp/6no631256751253.ps tmp/6no631256751253.png") > system("convert tmp/7lfcs1256751253.ps tmp/7lfcs1256751253.png") > system("convert tmp/8vu2y1256751253.ps tmp/8vu2y1256751253.png") > > > proc.time() user system elapsed 2.546 1.911 2.916