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(106370,109375,116476,123297,114813,117925,126466,131235,120546,123791,129813,133463,122987,125418,130199,133016,121454,122044,128313,131556,120027,123001,130111,132524,123742,124931,133646,136557,127509,128945,137191,139716,129083,131604,139413,143125,133948,137116,144864,149277,138796,143258,150034,154708,144888,148762,156500,161088,152772,158011,163318,169969,162269,165765,170600,174681,166364,170240,176150,182056,172218,177856,182253,188090,176863,183273,187969,194650,183036,189516,193805,200499,188142,193732,197126,205140,191751,196700,199784,207360,196101,200824,205743,212489,200810,203683,207286,210910,194915,217920) > x <- c(100.3,101.9,102.1,103.2,103.7,106.2,107.7,109.9,111.7,114.9,116.0,118.3,120.4,126.0,128.1,130.1,130.8,133.6,134.2,135.5,136.2,139.1,139.0,139.6,138.7,140.9,141.3,141.8,142.0,144.5,144.6,145.5,146.8,149.5,149.9,150.1,150.9,152.8,153.1,154.0,154.9,156.9,158.4,159.7,160.2,163.2,163.7,164.4,163.7,165.5,165.6,166.8,167.5,170.6,170.9,172.0,171.8,173.9,174.0,173.8,173.9,176.0,176.6,178.2,179.2,181.3,181.8,182.9,183.8,186.3,187.4,189.2,189.7,191.9,192.6,193.7,194.2,197.6,199.3,201.4,203.0,206.3,207.1,209.8,211.1,215.3,217.4,215.5,210.9,212.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 4758.0824 2 6255.6951 3 13168.2717 4 18952.9430 5 9997.8845 6 10754.5919 7 17882.4163 8 20578.7589 9 8193.9482 10 8424.1737 11 13409.8450 12 14892.9758 13 2438.5301 14 -406.3253 15 2396.2289 16 3328.9949 17 -8892.4870 18 -10940.4147 19 -5236.6849 20 -3218.4371 21 -15406.9190 22 -15165.0584 23 -7960.8467 24 -6113.1169 25 -14047.2116 26 -14930.8690 27 -6592.7158 28 -4152.7744 29 -13389.1978 30 -14308.4903 31 -6156.7020 32 -4479.6074 33 -16337.3595 34 -16360.0755 35 -8927.9223 36 -5404.3457 37 -15335.0393 38 -13957.0617 39 -6491.6968 40 -2926.6021 41 -14255.5075 42 -11677.7415 43 -6314.9171 44 -2865.6692 45 -13156.7277 46 -12109.0788 47 -4842.1373 48 -913.6192 49 -8570.1373 50 -5026.9480 51 185.8403 52 5706.2999 53 -2653.1820 54 -2077.7448 55 2474.6201 56 5519.2913 57 -2609.2853 58 -711.7310 59 5104.0573 60 11198.4807 61 1266.2690 62 4925.8232 63 8757.5530 64 13087.1658 65 918.0487 66 5349.6030 67 9574.5445 68 15219.2157 69 2757.3104 70 6882.0178 71 10134.6891 72 15132.8784 73 2304.8199 74 5822.1625 75 8556.6805 76 15534.3518 77 1674.2933 78 3420.0954 79 4902.4964 80 10500.0507 81 -2266.3366 82 -652.3228 83 3512.9836 84 7715.2676 85 -5188.4845 86 -6272.3760 87 -4647.8218 88 766.2006 89 -10895.0611 90 10508.3399 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1xrw01257360141.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/2div51257360141.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/33f9q1257360141.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/4kfzv1257360141.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/5ou6i1257360141.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/6ymlp1257360141.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/7mau21257360141.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/822q51257360141.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. 100.3 139.0 161.7 160.0 182.6 217.4 > > #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/959zd1257360141.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/10o2t01257360141.tab") > > system("convert tmp/1xrw01257360141.ps tmp/1xrw01257360141.png") > system("convert tmp/2div51257360141.ps tmp/2div51257360141.png") > system("convert tmp/33f9q1257360141.ps tmp/33f9q1257360141.png") > system("convert tmp/4kfzv1257360141.ps tmp/4kfzv1257360141.png") > system("convert tmp/5ou6i1257360141.ps tmp/5ou6i1257360141.png") > system("convert tmp/6ymlp1257360141.ps tmp/6ymlp1257360141.png") > system("convert tmp/7mau21257360141.ps tmp/7mau21257360141.png") > system("convert tmp/822q51257360141.ps tmp/822q51257360141.png") > > > proc.time() user system elapsed 1.591 1.151 2.002