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(64,65.61,59.29,56.25,57.76,60.84,60.84,60.84,56.25,56.25,50.41,56.25,56.25,57.76,59.29,59.29,62.41,65.61,67.24,67.24,67.24,62.41,53.29,47.61,43.56,44.89,47.61,49,50.41,51.84,50.41,47.61,49,46.24,40.96,44.89,43.56,40.96,39.69,38.44,42.25,46.24,46.24,40.96,37.21,33.64,37.21,51.84,53.29,47.61,37.21,33.64,38.44,50.41,59.29,62.41,59.29,54.76,56.25,64) > x <- c(123.21,118.81,100,84.64,84.64,90.25,92.16,90.25,82.81,79.21,81,102.01,106.09,104.04,92.16,84.64,86.49,88.36,88.36,84.64,81,81,81,96.04,100,96.04,86.49,81,81,82.81,82.81,82.81,84.64,77.44,68.89,70.56,65.61,59.29,62.41,62.41,64,62.41,57.76,50.41,46.24,42.25,47.61,67.24,75.69,68.89,62.41,56.25,60.84,68.89,70.56,67.24,59.29,51.84,53.29,65.61) > 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 -2.2631985 2 0.7312653 3 0.3298484 4 2.1228859 5 3.6328859 6 4.9476944 7 4.3467112 8 4.9476944 9 2.6986970 10 3.8314401 11 -2.5717850 12 -3.3425999 13 -4.6263755 14 -2.4713412 15 2.7967112 16 5.1628859 17 7.7007817 18 10.3123846 19 11.9423846 20 13.1128859 21 14.2582150 22 9.4282150 23 0.3082150 24 -10.1041342 25 -15.4001516 26 -12.8241342 27 -7.0992183 28 -3.9817850 29 -2.5717850 30 -1.7113030 31 -3.1413030 32 -5.9413030 33 -5.1271141 34 -5.6216278 35 -8.2113628 36 -4.8068298 37 -4.5793079 38 -5.1907144 39 -7.4424251 40 -8.6924251 41 -5.3827200 42 -0.8924251 43 0.5707015 44 -2.3966146 45 -4.8345204 46 -7.1490634 47 -5.2655921 48 3.1878111 49 1.9790112 50 -1.5613628 51 -9.9224251 52 -11.5541757 53 -8.1984232 54 1.2386372 55 9.5931702 56 13.7578111 57 13.1392856 58 10.9534347 59 11.9871909 60 15.8606921 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/12ftq1256919597.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/2i2i71256919597.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/3csqp1256919597.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/4sxgm1256919597.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/5nnpk1256919597.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/6stk31256919597.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/7299n1256919597.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/8eppw1256919597.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. 42.25 63.60 81.00 77.43 86.96 123.20 > > #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/9g9dc1256919597.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/100wkz1256919597.tab") > > system("convert tmp/12ftq1256919597.ps tmp/12ftq1256919597.png") > system("convert tmp/2i2i71256919597.ps tmp/2i2i71256919597.png") > system("convert tmp/3csqp1256919597.ps tmp/3csqp1256919597.png") > system("convert tmp/4sxgm1256919597.ps tmp/4sxgm1256919597.png") > system("convert tmp/5nnpk1256919597.ps tmp/5nnpk1256919597.png") > system("convert tmp/6stk31256919597.ps tmp/6stk31256919597.png") > system("convert tmp/7299n1256919597.ps tmp/7299n1256919597.png") > system("convert tmp/8eppw1256919597.ps tmp/8eppw1256919597.png") > > > proc.time() user system elapsed 1.592 1.160 2.332