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(94.3,99.4,115.7,116.8,99.8,96,115.9,109.1,117.3,109.8,112.8,110.7,100,113.3,122.4,112.5,104.2,92.5,117.2,109.3,106.1,118.8,105.3,106,102,112.9,116.5,114.8,100.5,85.4,114.6,109.9,100.7,115.5,100.7,99,102.3,108.8,105.9,113.2,95.7,80.9,113.9,98.1,102.8,104.7,95.9,94.6,101.6,103.9,110.3,114.1,96.8,87.4,111.4,97.4,102.9,112.7,97,95.1) > x <- c(85,96.1,113.6,116.8,102.7,106.8,124.2,117.8,121.6,117.9,111.4,109.8,92.6,104.9,120.3,109.1,93.1,87.3,106.9,102.1,102.4,113.3,100.6,103.5,93.7,102.6,108.1,105.9,87.1,81.8,103.8,95.8,92.7,101.1,88,92.8,89.7,95.6,95.2,96.9,79.2,73.5,99.7,87.8,91.3,93.9,90,89.8,88.9,104.2,110.8,110.5,87.1,89.2,96.5,95.4,101,107.6,93.8,93.8) > 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 -1.45337938 2 -3.71315451 3 0.98359640 4 -0.03814058 5 -7.68923703 6 -14.20771253 7 -5.84465734 8 -8.40118338 9 -2.72074604 10 -7.76748766 11 -0.45770943 12 -1.49684094 13 -0.79250470 14 4.35206880 15 3.24120960 16 0.76728902 17 3.07597390 18 -4.77837783 19 6.92598319 20 2.20858866 21 -1.19032419 22 4.28250924 23 -0.79684714 24 -2.01967127 25 0.47814822 26 5.47706725 27 5.43033182 28 5.18902600 29 3.35423073 30 -8.23164240 31 6.38141589 32 6.98575833 33 -0.15880898 34 9.07163146 35 2.95749221 36 -1.92511326 37 3.43031944 38 6.01836689 39 3.38358401 40 9.55641124 41 3.79226889 42 -7.22838712 43 8.39989139 44 0.49010077 45 2.86945095 46 3.04553966 47 -3.16859340 48 -4.33598484 49 3.26075368 50 -4.58380124 51 -2.55988375 52 1.43902909 53 -0.34576927 54 -11.13815916 55 8.02162836 56 -5.24902455 57 -3.46206426 58 1.96185323 59 -4.58815606 60 -6.48815606 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1c1ut1257792809.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/2any71257792809.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/3vj8n1257792809.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/4ec3d1257792809.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/5st9c1257792809.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/6x4fv1257792809.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/7fxkc1257792809.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/8nwsw1257792809.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. 73.50 92.28 98.30 99.58 107.10 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/98dl61257792809.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/107vyk1257792809.tab") > > system("convert tmp/1c1ut1257792809.ps tmp/1c1ut1257792809.png") > system("convert tmp/2any71257792809.ps tmp/2any71257792809.png") > system("convert tmp/3vj8n1257792809.ps tmp/3vj8n1257792809.png") > system("convert tmp/4ec3d1257792809.ps tmp/4ec3d1257792809.png") > system("convert tmp/5st9c1257792809.ps tmp/5st9c1257792809.png") > system("convert tmp/6x4fv1257792809.ps tmp/6x4fv1257792809.png") > system("convert tmp/7fxkc1257792809.ps tmp/7fxkc1257792809.png") > system("convert tmp/8nwsw1257792809.ps tmp/8nwsw1257792809.png") > > > proc.time() user system elapsed 2.573 1.926 2.960