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(9,8.6,8.8,8.5,8.3,8.2,8,7.9,8,9.3,9.6,9,8.7,8.3,8.4,7.8,7.8,7.6,7.7,7.6,7.6,8.6,8.6,8.2,7.5,7.1,7,6.9,6.6,6.3,6.1,5.9,6,7.2,7.2,6.4,6.1,5.9,6.1,5.9,5.8,5.7,5.6,5.3,5.5,6.5,6.5,6.1,5.9,5.8,6.2,6.5,6.6,6.7,6.6,6.5,6.8,7.8,7.9,7.4) > x <- c(100.64,100.63,100.43,100.8,101.33,101.88,101.85,102.04,102.22,102.63,102.65,102.54,102.37,102.68,102.76,102.82,103.31,103.23,103.6,103.95,103.93,104.25,104.38,104.36,104.32,104.58,104.68,104.92,105.46,105.23,105.58,105.34,105.28,105.7,105.67,105.71,106.19,106.93,107.44,107.85,108.71,109.32,109.49,110.2,110.62,111.22,110.88,111.15,111.29,111.09,111.24,111.45,111.75,111.07,111.17,110.96,110.5,110.48,110.66,110.46) > par2 = '1' > 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 0.58520236 2 0.18297657 3 0.33846082 4 0.12081496 5 0.03878169 6 0.06119999 7 -0.14547737 8 -0.20318741 9 -0.06312324 10 1.32813404 11 1.63258562 12 1.00810196 13 0.67026357 14 0.33926298 15 0.45706928 16 -0.12957600 17 -0.02051242 18 -0.23831872 19 -0.05596458 20 -0.07806203 21 -0.08251360 22 0.98871159 23 1.01764683 24 0.61319525 25 -0.09570790 26 -0.43783742 27 -0.51557955 28 -0.56216065 29 -0.74196814 30 -1.09316125 31 -1.21525869 32 -1.46867759 33 -1.38203231 34 -0.08854924 35 -0.09522660 36 -0.88632345 37 -1.07948566 38 -1.11477740 39 -0.80126224 40 -0.91000496 41 -0.81858725 42 -0.78281422 43 -0.84497583 44 -0.98694493 45 -0.69346186 46 0.44008538 47 0.36440861 48 0.02450487 49 -0.14433411 50 -0.28884986 51 0.14453695 52 0.49127849 53 0.65805211 54 0.60669857 55 0.52895644 56 0.38221491 57 0.57982869 58 1.57537712 59 1.71544129 60 1.17092554 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/10r381257511941.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/2dz5g1257511941.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/38fa31257511941.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/4vvth1257511941.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/5wbla1257511941.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/6o4cx1257511941.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/7qtt31257511941.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/8e9261257511941.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. 100.4 102.8 105.3 106.1 110.5 111.8 > > #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/9jfzb1257511941.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/10r43r1257511941.tab") > > system("convert tmp/10r381257511941.ps tmp/10r381257511941.png") > system("convert tmp/2dz5g1257511941.ps tmp/2dz5g1257511941.png") > system("convert tmp/38fa31257511941.ps tmp/38fa31257511941.png") > system("convert tmp/4vvth1257511941.ps tmp/4vvth1257511941.png") > system("convert tmp/5wbla1257511941.ps tmp/5wbla1257511941.png") > system("convert tmp/6o4cx1257511941.ps tmp/6o4cx1257511941.png") > system("convert tmp/7qtt31257511941.ps tmp/7qtt31257511941.png") > system("convert tmp/8e9261257511941.ps tmp/8e9261257511941.png") > > > proc.time() user system elapsed 1.613 1.188 2.451