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(45319,46603,47943,45773,53225,57281,62241,61814,70727,67625,65618,63052,62410,60571,62543,62985,62739,63552,64171,63063,62985,63005,61880,62555,62254,63290,65570,66277,67061,66779,67350,67746,64551,65550,64260,61208,59603,56345,53474,50877,51749,51580,51039,50708,51245,49937,50274,51134,52514,54027,57526,59303,60939,60808,60109,59678,60092,60292,60927,59801,58352,59298,59234,56696,55434,56458,56951,56756,58545,58459) > x <- c(18234,18989,18315,16020,21277,25816,29747,32185,39228,37028,34974,31455,30342,31150,32564,33756,32960,34947,30217,32096,30015,29706,27064,30058,28177,27062,28541,29117,30572,32482,31412,31029,25084,29468,30462,24755,24535,19576,18101,16006,14926,12766,13440,14723,15448,11842,11492,13342,16334,22768,22397,12430,16714,23804,25533,25648,23595,21547,22757,24885,27730,33168,24939,20630,28186,25205,28906,33856,40915,56037) > 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 -9870.297598 2 -8965.828443 3 -7287.015477 4 -8303.342246 5 -3493.982845 6 -1719.692123 7 1264.234034 8 -388.323847 9 4984.231463 10 2988.149157 11 2013.674131 12 1216.639751 13 1134.133567 14 -1111.039841 15 150.156696 16 -7.049618 17 147.091511 18 -38.753243 19 2957.969799 20 905.415551 21 1873.513151 22 2048.844318 23 2251.950931 24 1421.897487 25 2066.457115 26 3662.956310 27 5199.478006 28 5616.928646 29 5669.514899 30 4427.377264 31 5536.255415 32 6124.785632 33 5918.276855 34 4713.484505 35 2923.810783 36 2740.661819 37 1246.253589 38 481.092609 39 -1648.439847 40 -3192.304588 41 -1777.399538 42 -860.589439 43 -1740.402405 44 -2716.353497 45 -2543.803646 46 -2039.104007 47 -1526.162556 48 -1596.138799 49 -1720.186862 50 -3441.493427 51 244.004511 52 7031.314354 53 6513.790990 54 2818.719877 55 1250.569108 56 761.759774 57 2207.782058 58 3437.290893 59 3464.036161 60 1268.312137 61 -1610.840517 62 -3398.467980 63 674.166885 64 302.257495 65 -4758.067093 66 -2235.548618 67 -3603.003793 68 -6286.318604 69 -8045.806332 70 -15733.482408 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1mtz91257182760.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/26ur21257182760.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/3ev9w1257182760.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/4hp8u1257182760.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/5krgt1257182760.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/630ip1257182760.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/74erk1257182760.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/8c1m81257182760.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. 11490 19840 26440 25860 30910 56040 > > #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/9vupm1257182760.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/103hy61257182760.tab") > > system("convert tmp/1mtz91257182760.ps tmp/1mtz91257182760.png") > system("convert tmp/26ur21257182760.ps tmp/26ur21257182760.png") > system("convert tmp/3ev9w1257182760.ps tmp/3ev9w1257182760.png") > system("convert tmp/4hp8u1257182760.ps tmp/4hp8u1257182760.png") > system("convert tmp/5krgt1257182760.ps tmp/5krgt1257182760.png") > system("convert tmp/630ip1257182760.ps tmp/630ip1257182760.png") > system("convert tmp/74erk1257182760.ps tmp/74erk1257182760.png") > system("convert tmp/8c1m81257182760.ps tmp/8c1m81257182760.png") > > > proc.time() user system elapsed 2.569 1.933 3.016