R version 2.8.1 (2008-12-22) 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(131.05,119.47,120.22,119.13,121.16,122.81,124.21,122.43,119.33,121.97,118.96,116.33,114.74,112.22,111.88,113.99,117.8,116.74,113.09,112.94,113.04,116.46,121.33,115.99,116.58,117.98,121.54,127.45,116.88,109.81,110.96,110.41,114.9,115.3,116.4,116.93,115.83,115.72,114.63,119.4,125.1,129.73,127.31,129.43,137.73,139.95,146.16,142.18,140.21,133.9,137.49,145.88,153.86,151.88,160.5,166.51,166.23,169.35,170.33,162.31,156.53) > x <- c(104.89,105.15,105.24,105.57,105.62,106.17,106.27,106.41,106.94,107.16,107.32,107.32,107.35,107.55,107.87,108.37,108.38,107.92,108.03,108.14,108.3,108.64,108.66,109.04,109.03,109.03,109.54,109.75,109.83,109.65,109.82,109.95,110.12,110.15,110.21,109.99,110.14,110.14,110.81,110.97,110.99,109.73,109.81,110.02,110.18,110.21,110.25,110.36,110.51,110.6,110.95,111.18,111.19,111.69,111.7,111.83,111.77,111.73,112.01,111.86,112.04) > 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 25.6570614 2 12.7348610 3 13.0202531 4 10.2266910 5 11.9985755 6 10.8093053 7 11.6930743 8 9.1903510 9 3.3543270 10 4.8586189 11 1.0226494 12 -1.6073506 13 -3.3522199 14 -6.9046818 15 -8.8966208 16 -9.3677755 17 -5.6093986 18 -4.2947363 19 -8.5125903 20 -9.2304444 21 -9.9564139 22 -8.2915991 23 -3.5248453 24 -10.8265229 25 -10.1848998 26 -8.7848998 27 -7.8576776 28 -3.0317626 29 -14.0147474 30 -20.1555317 31 -19.8831243 32 -21.1042245 33 -17.4918171 34 -17.2466864 35 -16.4564250 36 -14.7907169 37 -16.6650633 38 -16.7750633 39 -21.3238107 40 -17.3797802 41 -11.7830264 42 -0.6485164 43 -3.4815012 44 -2.4455862 45 5.0284443 46 7.0935750 47 13.0970826 48 8.5492286 49 5.8048822 50 -0.9697257 51 0.8134660 52 8.0161348 53 15.9445117 54 11.3833570 55 19.9517339 56 25.2906337 57 25.3203722 58 28.6468646 59 28.1814180 60 20.9357644 61 14.2265487 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1932k1257349465.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/rcomp/tmp/2ne5o1257349465.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/rcomp/tmp/3hfmo1257349465.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/rcomp/tmp/4ydjw1257349465.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/rcomp/tmp/52v4b1257349465.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/rcomp/tmp/6fba31257349465.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/rcomp/tmp/72paw1257349465.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/rcomp/tmp/89u6x1257349465.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. 104.9 107.9 109.8 109.2 110.5 112.0 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/98m7i1257349465.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/rcomp/tmp/10whq01257349465.tab") > > system("convert tmp/1932k1257349465.ps tmp/1932k1257349465.png") > system("convert tmp/2ne5o1257349465.ps tmp/2ne5o1257349465.png") > system("convert tmp/3hfmo1257349465.ps tmp/3hfmo1257349465.png") > system("convert tmp/4ydjw1257349465.ps tmp/4ydjw1257349465.png") > system("convert tmp/52v4b1257349465.ps tmp/52v4b1257349465.png") > system("convert tmp/6fba31257349465.ps tmp/6fba31257349465.png") > system("convert tmp/72paw1257349465.ps tmp/72paw1257349465.png") > system("convert tmp/89u6x1257349465.ps tmp/89u6x1257349465.png") > > > proc.time() user system elapsed 2.210 1.910 3.838