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(10284.5,12792,12823.61538,13845.66667,15335.63636,11188.5,13633.25,12298.46667,15353.63636,12696.15385,12213.93333,13683.72727,11214.14286,13950.23077,11179.13333,11801.875,11188.82353,16456.27273,11110.0625,16530.69231,10038.41176,11681.25,11148.88235,8631,9386.444444,9764.736842,12043.75,12948.06667,10987.125,11648.3125,10633.35294,10219.3,9037.6,10296.31579,11705.41176,10681.94444,9362.947368,11306.35294,10984.45,10062.61905,8118.583333,8867.48,8346.72,8529.307692,10697.18182,8591.84,8695.607143,8125.571429,7009.758621,7883.466667,7527.645161,6763.758621,6682.333333,7855.681818,6738.88,7895.434783,6361.884615,6935.956522,8344.454545,9107.944444) > x <- c(9904.642857,13710.15385,13747.69231,14517,15185.81818,11422.28571,13819.66667,12749,16217,13238,12391,14780.09091,10815.42857,14770.84615,11831,11931.3125,10611.94118,15923.18182,11094.875,16209.53846,10100,12149.6875,11644.35294,9249.947368,8980.777778,10244.52632,12457.5625,13307.46667,10839.625,11827.625,10925.94118,10675.3,9297.3,10433.21053,12261.41176,10911.22222,9334.421053,11655.05882,11080,9840.142857,7448.916667,8362.6,8465.64,8220.923077,10432.86364,8537.4,8535.464286,7997.464286,6301.413793,7595.566667,7200.483871,6152.482759,6064.259259,7269.909091,6578.44,7708.26087,6401.153846,7042.043478,8296.409091,9613.333333) > 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 396.616473 2 -532.234143 3 -534.515738 4 -207.144074 5 678.887335 6 -69.804730 7 210.126523 8 -157.852066 9 -234.262854 10 -201.728569 11 80.886166 12 -606.652782 13 503.826011 14 -331.801326 15 -448.237632 16 83.922531 17 662.254414 18 1133.689340 19 147.407420 20 949.530816 21 -25.877943 22 -233.893613 23 -309.947583 24 -665.697941 25 332.804817 26 -430.059147 27 -149.402650 28 -12.543681 29 254.958939 30 23.989140 31 -176.756046 32 -364.481701 33 -301.857047 34 -68.860761 35 -310.618102 36 -114.873425 37 -10.029738 38 -162.144330 39 35.226944 40 232.978585 41 448.203899 42 372.050714 43 -241.753708 44 161.811706 45 332.318508 46 -61.432501 47 44.082579 48 -40.142784 49 375.566500 50 80.663278 51 81.598857 52 264.050213 53 262.290147 54 346.945011 55 -145.464907 56 -9.130707 57 -362.372098 58 -367.019182 59 -91.204799 60 -516.888559 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ioce1257802366.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/2f81l1257802366.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/3g4jj1257802366.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/40sfz1257802366.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/5np8e1257802366.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/6x7k51257802366.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/7gshs1257802366.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/8033g1257802366.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. 6064 8440 10640 10610 12290 16220 > > #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/9gb8u1257802366.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/10r9rd1257802366.tab") > > system("convert tmp/1ioce1257802366.ps tmp/1ioce1257802366.png") > system("convert tmp/2f81l1257802366.ps tmp/2f81l1257802366.png") > system("convert tmp/3g4jj1257802366.ps tmp/3g4jj1257802366.png") > system("convert tmp/40sfz1257802366.ps tmp/40sfz1257802366.png") > system("convert tmp/5np8e1257802366.ps tmp/5np8e1257802366.png") > system("convert tmp/6x7k51257802366.ps tmp/6x7k51257802366.png") > system("convert tmp/7gshs1257802366.ps tmp/7gshs1257802366.png") > system("convert tmp/8033g1257802366.ps tmp/8033g1257802366.png") > > > proc.time() user system elapsed 1.572 1.149 1.953