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(100.00,100.22,113.63,115.38,114.95,114.07,111.87,112.53,114.07,113.63,112.09,111.87,110.11,111.43,125.05,127.47,127.03,124.18,120.22,121.98,123.52,123.30,121.98,119.56,118.02,119.34,130.55,134.29,134.73,134.29,130.55,130.77,129.89,129.45,128.35,125.93,124.62,125.05,136.48,138.24,138.02,134.51,130.77,131.21,130.33,129.67,127.47,126.15,125.93,125.93,136.26,137.58,136.26,129.23,124.40,122.42,123.30,120.66,116.92,115.60,112.31,109.67,121.98,124.18,119.12,115.82,112.09,112.97,113.63,111.65,108.35,107.69,103.08,105.05,116.04,117.36,113.85,111.21,110.33,113.41,116.04,117.14,117.80,118.02,115.16,117.80,129.01,131.21,127.69,123.96) > x <- c(100.00,99.76,98.74,99.12,100.22,99.98,100.44,100.19,101.59,102.08,101.43,100.27,101.24,100.92,103.04,102.76,102.36,101.35,101.68,100.29,102.68,102.89,103.30,101.75,103.42,102.92,103.44,103.01,103.45,101.87,100.70,101.24,102.73,102.46,103.90,102.32,102.25,103.21,104.00,103.94,103.08,103.27,103.14,102.63,104.49,104.39,105.49,104.68,103.46,103.38,103.25,104.44,104.47,103.68,104.22,103.18,104.30,105.00,107.23,105.92,106.73,107.72,106.78,107.59,110.69,108.11,109.74,108.76,109.66,110.48,110.25,109.93,110.64,110.44,109.90,110.33,112.38,116.42,117.83,118.28,122.75,124.20,122.34,123.17,121.92,122.68,122.30,123.72,123.78,123.07) > 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 -22.33496756 2 -22.16031258 3 -8.94302894 4 -7.12123265 5 -7.34340128 6 -8.26874631 7 -10.38183501 8 -9.76906941 9 -7.96455677 10 -8.31197734 11 -9.97478678 12 -10.41395440 13 -11.99068493 14 -10.73114496 15 3.28940276 16 5.65650023 17 5.14092519 18 2.10009821 19 -1.79755238 20 -0.30017565 21 1.69138522 22 1.51106212 23 0.26852654 24 -2.44432675 25 -3.66880095 26 -2.44326975 27 8.86497780 28 12.52373463 29 13.04686718 30 12.30834576 31 8.34728877 32 8.66931507 33 8.07083210 34 7.57981895 35 6.75188910 36 4.03336768 37 2.71014205 38 3.32152215 39 14.90078286 40 16.64944660 41 16.26696026 42 12.79285841 43 9.02829652 44 9.37193834 45 8.84336228 46 8.16446852 47 6.17229989 48 4.69926043 49 4.24875655 50 4.23364154 51 14.53907966 52 16.08391540 53 14.76958353 54 7.59032282 55 2.86234913 56 0.68585402 57 1.77746414 58 -0.73027954 59 -4.04894868 60 -5.61645694 61 -8.75341749 62 -11.20636926 63 0.92602939 64 3.27906885 65 -1.19522458 66 -4.98268359 67 -8.40471530 68 -7.70987415 69 -6.87983031 70 -8.70490147 71 -12.04835712 72 -12.76881716 73 -17.24467146 74 -15.31245898 75 -4.42448528 76 -3.02324211 77 -6.14592003 78 -8.02261211 79 -8.63621009 80 -5.47118817 81 -1.99663708 82 -0.62267756 83 -0.31410150 84 0.06271671 85 -3.03345529 86 -0.24986271 87 10.88834100 88 13.35663239 89 9.84796865 90 5.98382295 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/16ihg1262200211.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/2os3m1262200211.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/3lv7m1262200211.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/45jl51262200211.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/519yq1262200211.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/69ony1262200211.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/7obvj1262200211.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/8h4jd1262200211.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. 98.74 102.30 103.60 106.70 109.70 124.20 > > #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/9ja4q1262200211.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/10rzcq1262200211.tab") > > try(system("convert tmp/16ihg1262200211.ps tmp/16ihg1262200211.png",intern=TRUE)) character(0) > try(system("convert tmp/2os3m1262200211.ps tmp/2os3m1262200211.png",intern=TRUE)) character(0) > try(system("convert tmp/3lv7m1262200211.ps tmp/3lv7m1262200211.png",intern=TRUE)) character(0) > try(system("convert tmp/45jl51262200211.ps tmp/45jl51262200211.png",intern=TRUE)) character(0) > try(system("convert tmp/519yq1262200211.ps tmp/519yq1262200211.png",intern=TRUE)) character(0) > try(system("convert tmp/69ony1262200211.ps tmp/69ony1262200211.png",intern=TRUE)) character(0) > try(system("convert tmp/7obvj1262200211.ps tmp/7obvj1262200211.png",intern=TRUE)) character(0) > try(system("convert tmp/8h4jd1262200211.ps tmp/8h4jd1262200211.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.671 1.220 3.538