R version 2.8.1 (2008-12-22) 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(5,1.3,0,1.3,3,1.3,-1,-1.3,-2,-0.3,0.7,-6,-1,3,-2,-1.3,1.7,4,5.3,-3,1.3,8.7,7.3,7.3,7.7,4.7,4.7,3.7,8.3,8,8.3,12.7,11.7,9.7,9.3,9.3,7.7,8.3,7.7,7,4.3,-0.3,4.7,2,0.3,-1.7,1.3,-12.3,-14.3,-15.7,-16.7,-19,-27.3,-26.7,-26.3,-28.6,-22.9,-21.9,-17.6,-17.6,-20.8) > x <- c(785.8,819.3,849.4,880.4,900.1,937.2,948.9,952.6,947.3,974.2,1000.8,1032.8,1050.7,1057.3,1075.4,1118.4,1179.8,1227,1257.8,1251.5,1236.3,1170.6,1213.1,1265.5,1300.8,1348.4,1371.9,1403.3,1451.8,1474.2,1438.2,1513.6,1562.2,1546.2,1527.5,1418.7,1448.5,1492.1,1395.4,1403.7,1316.6,1274.5,1264.4,1323.9,1332.1,1250.2,1096.7,1080.8,1039.2,792,746.6,688.8,715.8,672.9,629.5,681.2,755.4,760.6,765.9,836.8,904.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 18.1423649 2 13.3048914 3 10.9828630 4 11.2302756 5 12.2613732 6 9.3016638 7 6.6043969 8 6.1787655 9 5.6587240 10 6.4453498 11 6.5421619 12 -1.2443800 13 3.1478357 14 6.9237364 15 1.3091612 16 0.5491206 17 1.4643185 18 2.1616692 19 2.4158727 20 -5.6702144 21 -0.8541070 22 8.7766992 23 5.9336358 24 4.1544236 25 3.3558321 26 -1.2603989 27 -2.0583280 28 -4.1244972 29 -1.1712872 30 -2.2318665 31 -0.7095069 32 1.1303289 33 -1.5198566 34 -2.9765856 35 -2.7416377 36 0.9526045 37 -1.6592376 38 -2.5396508 39 0.1437428 40 -0.8380790 41 -0.5806479 42 -3.7511663 43 1.5917735 44 -3.1285153 45 -5.1069416 46 -4.3260736 47 3.8859318 48 -9.1741927 49 -9.7616883 50 -2.7681526 51 -2.2266214 52 -2.5640552 53 -11.7808248 54 -9.7241797 55 -7.8505573 56 -11.9060015 57 -8.7254204 58 -7.9019834 59 -3.7819419 60 -6.1893112 61 -11.7016080 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1xam41257790880.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/rcomp/tmp/2dyav1257790880.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/rcomp/tmp/3icla1257790880.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/rcomp/tmp/4vl4a1257790880.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/rcomp/tmp/5ths41257790880.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/rcomp/tmp/6n3001257790880.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/rcomp/tmp/7d9l31257790880.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/rcomp/tmp/8o56t1257790880.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. 629.5 900.1 1118.0 1117.0 1332.0 1562.0 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9iqp81257790880.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/rcomp/tmp/10776c1257790880.tab") > > system("convert tmp/1xam41257790880.ps tmp/1xam41257790880.png") > system("convert tmp/2dyav1257790880.ps tmp/2dyav1257790880.png") > system("convert tmp/3icla1257790880.ps tmp/3icla1257790880.png") > system("convert tmp/4vl4a1257790880.ps tmp/4vl4a1257790880.png") > system("convert tmp/5ths41257790880.ps tmp/5ths41257790880.png") > system("convert tmp/6n3001257790880.ps tmp/6n3001257790880.png") > system("convert tmp/7d9l31257790880.ps tmp/7d9l31257790880.png") > system("convert tmp/8o56t1257790880.ps tmp/8o56t1257790880.png") > > > proc.time() user system elapsed 2.010 1.620 3.504