R version 2.8.0 (2008-10-20) 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(130,136.7,138.1,139.5,140.4,144.6,151.4,147.9,141.5,143.8,143.6,150.5,150.1,154.9,162.1,176.7,186.6,194.8,196.3,228.8,267.2,237.2,254.7,258.2,257.9,269.6,266.9,269.6,253.9,258.6,274.2,301.5,304.5,285.1,287.7,265.5,264.1,276.1,258.9,239.1,250.1,276.8,297.6,295.4,283,275.8,279.7,254.6,234.6,176.9,148.1,122.7,124.9,121.6,128.4,144.5,151.8,167.1,173.8,203.7,199.8) > x <- c(87.1,110.5,110.8,104.2,88.9,89.8,90,93.9,91.3,87.8,99.7,73.5,79.2,96.9,95.2,95.6,89.7,92.8,88,101.1,92.7,95.8,103.8,81.8,87.1,105.9,108.1,102.6,93.7,103.5,100.6,113.3,102.4,102.1,106.9,87.3,93.1,109.1,120.3,104.9,92.6,109.8,111.4,117.9,121.6,117.8,124.2,106.8,102.7,116.8,113.6,96.1,85,83.2,84.9,83,79.6,83.2,83.8,82.8,71.4) > 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 -54.25346947 2 -105.68517467 3 -105.03045295 4 -87.23433096 5 -48.32513910 6 -46.36097391 7 -40.05782610 8 -53.24644363 9 -53.18736527 10 -42.19245210 11 -71.95515689 12 0.03247886 13 -14.52780831 14 -53.69922635 15 -42.27598281 16 -28.66968717 17 -4.11254782 18 -3.61375663 19 9.81069572 20 9.76687784 21 69.03466946 22 31.33346065 23 28.95937340 24 87.11311333 25 73.64653053 26 38.64242549 27 30.47705150 28 46.84048649 29 53.25040855 30 33.60465167 31 56.40900830 32 52.15889479 33 82.23733867 34 63.58261694 35 54.25816459 36 80.74967835 37 64.94096509 38 37.19279060 39 -7.83093155 40 10.62668640 41 52.18309555 42 36.15380796 43 52.97899051 44 34.63129462 45 13.03952927 46 15.27972071 47 3.28045091 48 21.40659068 49 11.59206039 50 -81.13601838 51 -101.98638348 52 -83.91181762 53 -54.13652156 54 -52.96485193 55 -50.38809547 56 -29.56799975 57 -13.82151267 58 -7.46485193 59 -2.25540848 60 30.12885243 61 54.54942676 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/11z541257358169.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/freestat/rcomp/tmp/2ubp41257358169.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/freestat/rcomp/tmp/35ocw1257358169.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/freestat/rcomp/tmp/49dmg1257358169.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/freestat/rcomp/tmp/5ec8s1257358169.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/freestat/rcomp/tmp/6hkgd1257358169.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/freestat/rcomp/tmp/7mjrl1257358169.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/freestat/rcomp/tmp/846lv1257358169.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. 71.40 87.80 95.80 97.53 106.80 124.20 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9jiwp1257358169.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/freestat/rcomp/tmp/10pjix1257358169.tab") > > system("convert tmp/11z541257358169.ps tmp/11z541257358169.png") > system("convert tmp/2ubp41257358169.ps tmp/2ubp41257358169.png") > system("convert tmp/35ocw1257358169.ps tmp/35ocw1257358169.png") > system("convert tmp/49dmg1257358169.ps tmp/49dmg1257358169.png") > system("convert tmp/5ec8s1257358169.ps tmp/5ec8s1257358169.png") > system("convert tmp/6hkgd1257358169.ps tmp/6hkgd1257358169.png") > system("convert tmp/7mjrl1257358169.ps tmp/7mjrl1257358169.png") > system("convert tmp/846lv1257358169.ps tmp/846lv1257358169.png") > > > proc.time() user system elapsed 2.562 1.921 3.171