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,99.93,100.89,101.61,107.26,109.16,106.62,103.56,102.64,104.71,105.95,107.59,107.72,108.29,107.38,109.85,114.94,118.38,117.76,115.87,114.03,114.36,125.35,125.35,122.21,122.16,119.34,122.70,128.63,132.16,127.14,125.11,123.70,121.88,123.10,122.37,122.52,124.67,127.33,129.43,133.76,135.29,126.37,121.33,121.32,113.43,120.76,118.63,122.22,121.04,122.52,123.02,128.80,126.41,119.65,117.56,119.35,116.78,120.19,114.26) > x <- c(100,97.42,100.61,102.86,97.41,98.23,98.68,100.04,100.79,102.22,102.86,100.52,98.46,98.99,99.87,100.72,101.25,107.41,107.34,108.33,113.19,118.96,123.28,130.67,137.60,141.26,140.83,151.42,161.44,143.50,151.84,149.85,143.21,141.48,148.04,144.80,147.39,154.66,150.69,152.99,150.78,148.66,147.53,148.37,155.52,161.14,167.42,167.88,183.48,190.61,190.24,175.82,174.47,173.99,181.44,171.04,174.86,185.85,181.60,185.90) > 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 -10.2102850 2 -9.7685920 3 -9.4412666 4 -9.1675105 5 -2.4366087 6 -0.6992398 7 -3.3284886 8 -6.6582182 9 -7.7269661 10 -5.9405789 11 -4.8275105 12 -2.7234169 13 -2.1848558 14 -1.7199710 15 -2.8045020 16 -0.5030830 17 4.4818018 18 6.7000853 19 6.0939684 20 4.0076211 21 1.2037344 22 0.3893668 23 10.5225786 24 9.0569155 25 4.5424844 26 3.7665944 27 1.0318765 28 2.2915555 29 6.2342828 30 13.3223338 31 6.6482566 32 5.0129345 33 4.9198497 34 3.4429617 35 3.3619129 36 3.2745041 37 2.9108278 38 3.6189643 39 7.0663368 40 8.7101764 41 13.4784870 42 15.4289479 43 6.7330615 44 1.5264638 45 0.0984000 46 -8.9062180 47 -2.8217342 48 -5.0429663 49 -4.5469237 50 -7.1410209 51 -5.5876385 52 -2.2277112 53 3.8200351 54 1.5252338 55 -6.7123292 56 -6.7396910 57 -5.7073139 58 -10.4569672 59 -6.2040621 60 -12.9868837 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ifv01258121742.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/2njvl1258121742.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/3be6f1258121742.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/4fjrv1258121742.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/5k6nn1258121742.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/6ayt01258121742.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/7hngf1258121742.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/8fmax1258121742.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. 97.41 102.70 144.20 138.10 161.20 190.60 > > #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/97e2e1258121743.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/102lf31258121743.tab") > > system("convert tmp/1ifv01258121742.ps tmp/1ifv01258121742.png") > system("convert tmp/2njvl1258121742.ps tmp/2njvl1258121742.png") > system("convert tmp/3be6f1258121742.ps tmp/3be6f1258121742.png") > system("convert tmp/4fjrv1258121742.ps tmp/4fjrv1258121742.png") > system("convert tmp/5k6nn1258121742.ps tmp/5k6nn1258121742.png") > system("convert tmp/6ayt01258121742.ps tmp/6ayt01258121742.png") > system("convert tmp/7hngf1258121742.ps tmp/7hngf1258121742.png") > system("convert tmp/8fmax1258121742.ps tmp/8fmax1258121742.png") > > > proc.time() user system elapsed 1.657 1.208 2.266