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(14.5,14.3,15.3,14.4,13.7,14.2,13.5,11.9,14.6,15.6,14.1,14.9,14.2,14.6,17.2,15.4,14.3,17.5,14.5,14.4,16.6,16.7,16.6,16.9,15.7,16.4,18.4,16.9,16.5,18.3,15.1,15.7,18.1,16.8,18.9,19,18.1,17.8,21.5,17.1,18.7,19,16.4,16.9,18.6,19.3,19.4,17.6,18.6,18.1,20.4,18.1,19.6,19.9,19.2,17.8,19.2,22,21.1,19.5,22.2,20.9,22.2,23.5,21.5,24.3,22.8,20.3,23.7,23.3,19.6,18,17.3,16.8,18.2,16.5,16,18.4) > x <- c(219.04,216.09,256,237.16,225,240.25,228.01,136.89,265.69,278.89,225,222.01,213.16,234.09,320.41,268.96,237.16,320.41,252.81,193.21,316.84,320.41,302.76,278.89,256,275.56,364.81,316.84,295.84,345.96,265.69,228.01,368.64,313.29,364.81,324,306.25,316.84,445.21,295.84,376.36,392.04,309.76,262.44,380.25,396.01,400,299.29,357.21,345.96,457.96,345.96,392.04,432.64,384.16,313.29,392.04,492.84,428.49,320.41,436.81,449.44,457.96,529,453.69,571.21,501.76,334.89,519.84,497.29,316.84,268.96,256,268.96,313.29,275.56,262.44,334.89) > 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.058283814 2 -0.172035072 3 -0.338878214 4 -0.688055744 5 -1.032535508 6 -0.978397646 7 -1.320538461 8 -0.256475643 9 -1.322183402 10 -0.708109974 11 -0.632535508 12 0.254882708 13 -0.186371068 14 -0.398298579 15 -0.322024463 16 -0.617787939 17 -0.788055744 18 -0.022024463 19 -1.045612626 20 0.596904318 21 -0.817648867 22 -0.822024463 23 -0.405993857 24 0.591890026 25 0.061121786 26 0.189248775 27 -0.420141113 28 -0.517648867 29 -0.303674776 30 0.030973726 31 -0.822183402 32 0.879461539 33 -0.832118292 34 -0.513858009 35 0.079858887 36 1.373015205 37 0.991969496 38 0.382351133 39 0.329215224 40 0.296325224 41 -0.457826863 42 -0.616260851 43 -0.810651888 44 1.072836398 45 -0.671558254 46 -0.432331191 47 -0.448986268 48 0.695458052 49 0.002059035 50 -0.169026274 51 -1.143554760 52 -0.169026274 53 -0.016260851 54 -0.903277427 55 -0.185874382 56 0.486141991 57 -0.416260851 58 -0.563336489 59 0.418055548 60 1.977975537 61 1.274804861 62 -0.394456700 63 0.656445240 64 -0.120541400 65 0.081286639 66 -0.554629323 67 -0.024129293 68 2.354625783 69 0.347268251 70 0.606559478 71 2.182351133 72 1.982212061 73 1.661121786 74 0.782212061 75 0.886141991 76 0.289248775 77 0.172836398 78 0.454625783 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1y0pa1256757376.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/2kyjg1256757376.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/3ebfs1256757376.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/4ve131256757376.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/5jie71256757376.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/6xail1256757376.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/7sh8i1256757376.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/8xb041256757376.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. 136.9 263.3 316.8 328.5 383.2 571.2 > > #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/9n1yi1256757376.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/10frqp1256757376.tab") > > system("convert tmp/1y0pa1256757376.ps tmp/1y0pa1256757376.png") > system("convert tmp/2kyjg1256757376.ps tmp/2kyjg1256757376.png") > system("convert tmp/3ebfs1256757376.ps tmp/3ebfs1256757376.png") > system("convert tmp/4ve131256757376.ps tmp/4ve131256757376.png") > system("convert tmp/5jie71256757376.ps tmp/5jie71256757376.png") > system("convert tmp/6xail1256757376.ps tmp/6xail1256757376.png") > system("convert tmp/7sh8i1256757376.ps tmp/7sh8i1256757376.png") > system("convert tmp/8xb041256757376.ps tmp/8xb041256757376.png") > > > proc.time() user system elapsed 1.635 1.186 3.022