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(109.7,99.1,86.7,111.4,78.4,76.7,114.2,99.7,94.2,173.5,83.1,88.9,132.0,122.1,105.1,133.7,63.6,112.7,120.5,112.0,126.2,209.2,91.0,116.7,137.6,108.1,136.6,152.3,114.3,120.7,131.8,129.4,187.5,189.5,109.2,158.1,176.2,125.5,155.0,170.3,99.4,139.2,169.6,136.1,168.2,318.6,154.1,161.4,183.4,166.3,203,174.6,124.3,154.4,170.5,169.4,171.1,289.2,145.6,134.4,168.2) > x <- c(115.6,111.3,114.6,137.5,83.7,106.0,123.4,126.5,120.0,141.6,90.5,96.5,113.5,120.1,123.9,144.4,90.8,114.2,138.1,135.0,131.3,144.6,101.7,108.7,135.3,124.3,138.3,158.2,93.5,124.8,154.4,152.8,148.9,170.3,124.8,134.4,154.0,147.9,168.1,175.7,116.7,140.8,164.2,173.8,167.8,166.6,135.1,158.1,151.8,166.7,165.3,187.0,125.2,144.4,181.7,175.9,166.3,181.5,121.8,134.8,162.9) > 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.6299837 2 -5.5006994 3 -22.2975920 4 -28.1093622 5 10.5733118 6 -20.8390233 7 -6.5226391 8 -25.1530534 9 -21.9925073 10 28.5278318 11 6.2130482 12 4.0186979 13 24.4680389 14 5.7742536 15 -16.2888349 16 -15.0028650 17 -13.6866693 18 4.2353647 19 -19.8087972 20 -24.1783829 21 -5.0485336 22 60.2306567 23 -0.8097390 24 15.5635191 25 1.0218996 26 -13.8217916 27 -3.9752755 28 -14.7898706 29 33.4158731 30 -1.8879875 31 -30.2267821 32 -30.4949553 33 32.8013723 34 6.2881897 35 -13.3879875 36 22.7210521 37 14.7061746 38 -27.8662360 39 -25.2805485 40 -20.1067255 41 -12.3956146 42 -4.7062548 43 -5.4842208 44 -51.7751812 45 -11.6808310 46 140.3180391 47 17.7883779 48 -5.5566314 49 24.8374364 50 -12.1152001 51 26.4501483 52 -30.8627518 53 1.1790559 54 5.6971350 55 -27.9010757 56 -21.2732038 57 -6.7822434 58 91.0654026 59 27.0091877 60 -1.5119046 61 -5.1521116 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1bnh61256751845.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/26o971256751845.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/36byt1256751845.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/4sl641256751845.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/5330m1256751845.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/637lp1256751845.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/7ud4k1256751845.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/8uqr41256751845.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. 83.7 120.1 137.5 138.2 158.2 187.0 > > #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/9kvu41256751845.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/10bzt41256751845.tab") > > system("convert tmp/1bnh61256751845.ps tmp/1bnh61256751845.png") > system("convert tmp/26o971256751845.ps tmp/26o971256751845.png") > system("convert tmp/36byt1256751845.ps tmp/36byt1256751845.png") > system("convert tmp/4sl641256751845.ps tmp/4sl641256751845.png") > system("convert tmp/5330m1256751845.ps tmp/5330m1256751845.png") > system("convert tmp/637lp1256751845.ps tmp/637lp1256751845.png") > system("convert tmp/7ud4k1256751845.ps tmp/7ud4k1256751845.png") > system("convert tmp/8uqr41256751845.ps tmp/8uqr41256751845.png") > > > proc.time() user system elapsed 1.595 1.155 2.069