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(5.7,6.1,6,5.9,5.8,5.7,5.6,5.4,5.4,5.5,5.6,5.7,5.9,6.1,6,5.8,5.8,5.7,5.5,5.3,5.2,5.2,5,5.1,5.1,5.2,4.9,4.8,4.5,4.5,4.4,4.4,4.2,4.1,3.9,3.8,3.9,4.2,4.1,3.8,3.6,3.7,3.5,3.4,3.1,3.1,3.1,3.2,3.3,3.5,3.6,3.5,3.3,3.2,3.1,3.2,3,3,3.1,3.4) > x <- c(91.4,91.1,104.4,97.6,93.7,104.5,95.4,86.5,102.9,101.9,103.7,100.7,94.2,93.6,104.7,101,97.6,105.8,93.7,91.2,106.3,103.4,107.4,101.2,96.9,96.3,109.8,97.9,105.1,107.9,95,95.2,105.8,110.1,112.2,102.5,103.7,102,112.3,103.3,106.9,104.6,100.7,99,106.5,114.9,114.1,102.2,107,107.4,107.4,110.1,105.6,110.9,101.9,93.2,110.5,113.1,101.7,96.7) > 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 0.26483043 2 0.63965543 3 1.65574708 4 0.98511376 5 0.55783876 6 1.36413875 7 0.50049709 8 -0.44636123 9 0.92987208 10 0.94595542 11 1.19700541 12 1.04525542 13 0.69979709 14 0.84944709 15 1.68092208 16 1.17043042 17 0.88511376 18 1.47323041 19 0.25783876 20 -0.15195290 21 1.01518874 22 0.77183042 23 0.90749708 24 0.48721375 25 0.12637209 26 0.17602209 27 1.00889707 28 -0.08971124 29 0.21448875 30 0.44945541 31 -0.73306957 32 -0.71628624 33 -0.02676959 34 0.23407207 35 0.21029707 36 -0.70369458 37 -0.50299459 38 -0.34565292 39 0.41868874 40 -0.63656125 41 -0.53446126 42 -0.62746959 43 -1.15474458 44 -1.39740291 45 -1.06802792 46 -0.36312793 47 -0.43026127 48 -1.32886958 49 -0.82606959 50 -0.59250292 51 -0.49250292 52 -0.36592793 53 -0.94355292 54 -0.59879459 55 -1.45404458 56 -2.08411957 57 -0.83236126 58 -0.61417793 59 -1.47082792 60 -1.59041124 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/18t7k1257258191.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/21p9m1257258191.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/3uebe1257258191.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/4aagp1257258191.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/5km0k1257258191.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/67eyt1257258191.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/78brs1257258191.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/87yuu1257258191.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. 86.50 97.42 103.10 102.40 106.90 114.90 > > #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/9y1nj1257258191.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/10khfv1257258191.tab") > > system("convert tmp/18t7k1257258191.ps tmp/18t7k1257258191.png") > system("convert tmp/21p9m1257258191.ps tmp/21p9m1257258191.png") > system("convert tmp/3uebe1257258191.ps tmp/3uebe1257258191.png") > system("convert tmp/4aagp1257258191.ps tmp/4aagp1257258191.png") > system("convert tmp/5km0k1257258191.ps tmp/5km0k1257258191.png") > system("convert tmp/67eyt1257258191.ps tmp/67eyt1257258191.png") > system("convert tmp/78brs1257258191.ps tmp/78brs1257258191.png") > system("convert tmp/87yuu1257258191.ps tmp/87yuu1257258191.png") > > > proc.time() user system elapsed 1.590 1.164 2.098