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(126.51,131.02,136.51,138.04,132.92,129.61,122.96,124.04,121.29,124.56,118.53,113.14,114.15,122.17,129.23,131.19,129.12,128.28,126.83,138.13,140.52,146.83,135.14,131.84,125.7,128.98,133.25,136.76,133.24,128.54,121.08,120.23,119.08,125.75,126.89,126.6,121.89,123.44,126.46,129.49,127.78,125.29,119.02,119.96,122.86,131.89,132.73,135.01,136.71,142.73,144.43,144.93,138.75,130.22,122.19,128.4,140.43,153.5,149.33,142.97) > x <- c(150.85,147.79,141.96,148.39,147.71,150.6,151.18,152.24,157.19,154.62,157.22,159.7,160.55,149.66,151.69,154.13,151.48,153.34,155.8,158.87,156.09,156.3,156.4,154.09,161.32,160.12,155.17,154.51,151.38,152.59,153.98,154.91,153.01,155.09,155.53,161.86,166.03,164.54,164.33,163.21,159.95,164.18,167.13,166.8,166.29,168.07,167.1,163.53,168.28,169.07,165.84,163.88,157.33,161,163.54,161.21,158.92,160.18,159.9,164.46) > 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 -3.18754620 2 1.51564946 3 7.37373139 4 8.49776796 5 3.42070033 6 -0.07176224 7 -6.75838103 8 -5.74530501 9 -8.80782741 10 -5.37556831 11 -11.56972148 12 -17.11629836 13 -16.15996382 14 -7.45241456 15 -0.52058030 16 1.28536825 17 -0.61732178 18 -1.57475443 19 -3.18006859 20 7.92610439 21 10.49162201 22 16.78836349 23 5.09204990 24 1.93789369 25 -4.65857841 26 -1.30281541 27 3.27970698 28 6.83137664 29 3.50899181 30 -1.26740256 31 -8.81516137 32 -9.72387770 33 -10.75391961 34 -4.21524215 35 -3.10302192 36 -3.79267177 37 -8.76594821 38 -7.12187581 39 -4.08861728 40 -0.98790515 41 -2.49208232 42 -5.24914691 43 -11.70539763 44 -10.74456280 45 -7.81236352 46 1.10525469 47 2.00649645 48 4.51189139 49 5.91199616 50 11.88211885 51 13.78604760 52 14.40979384 53 8.64333358 54 -0.11837495 55 -8.30873997 56 -1.95163347 57 10.22294760 58 23.21339644 59 19.06107447 60 12.41317506 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1qic11257515938.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/2ljfb1257515938.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/3pohq1257515938.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/4bei71257515938.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/559aj1257515938.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/69zh31257515938.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/7280c1257515938.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/8tunv1257515938.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. 142.0 153.8 157.3 158.0 163.5 169.1 > > #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/9g8ij1257515938.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/10m6an1257515938.tab") > > system("convert tmp/1qic11257515938.ps tmp/1qic11257515938.png") > system("convert tmp/2ljfb1257515938.ps tmp/2ljfb1257515938.png") > system("convert tmp/3pohq1257515938.ps tmp/3pohq1257515938.png") > system("convert tmp/4bei71257515938.ps tmp/4bei71257515938.png") > system("convert tmp/559aj1257515938.ps tmp/559aj1257515938.png") > system("convert tmp/69zh31257515938.ps tmp/69zh31257515938.png") > system("convert tmp/7280c1257515938.ps tmp/7280c1257515938.png") > system("convert tmp/8tunv1257515938.ps tmp/8tunv1257515938.png") > > > proc.time() user system elapsed 1.612 1.163 2.636