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(646,-396,47,-953.4,-1263.8,-1166.4,-1896.6,-1689.2,181.4,-1132,-1065.6,-560.6,-131,45.4,341.2,-1211,-1952.8,-721.8,-1442.8,-2124.2,-1727,-1242.2,-811.2,-1969.2,87.2,-1144.8,-1084.4,-1526,1291.8,344.8,64.6,-75.2,2006.6,1654.4,1494.8,660,2173.8,1859.4,1829,514.8,-879,23.2,-753.6,-986,734.2,1162.8,1028.4,415,2304,1123.6,1489,-323.4,-958.4,-1077,-1397.6,-826.8,85.4,937.8,948.2,-333,1757.6,963.4,-371,-538.6,-1033.6,-1959.4,-1118,-1742,-280.2,282.6,463.4,-435.8) > x <- c(590,67,-57,-18.4,-527.8,-309.4,-744.6,-844.2,231.4,-253,-493.6,84.4,-194,167.4,408.2,-253,-864.8,-112.8,-193.8,-906.2,-1208,-584.2,-298.2,-425.2,-16.8,-437.8,-450.4,-747,973.8,796.8,321.6,264.8,1139.6,904.4,1049.8,1055,1245.8,1171.4,1210,594.8,-353,150.2,-396.6,-903,103.2,331.8,191.4,371,1065,543.6,789,334.6,512.6,-216,148.4,-344.8,38.4,669.8,316.2,-150,897.6,993.4,259,411.4,393.4,-287.4,-121,-447,-34.2,303.6,150.4,-169.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 -6.870902 2 -136.506997 3 522.808728 4 -544.928264 5 33.310690 6 -250.284103 7 -221.285687 8 159.864686 9 154.100219 10 -314.272868 11 171.849418 12 -331.460978 13 583.802714 14 129.747045 15 5.475863 16 -393.272868 17 -67.798992 18 -148.649196 19 -728.346182 20 -166.977452 21 756.707111 22 153.299456 23 85.377703 24 -851.073127 25 492.880565 26 -4.692658 27 77.687810 28 153.501069 29 -30.602961 30 -668.829708 31 -120.052026 32 -160.765468 33 394.961981 34 453.064066 35 39.816434 36 -804.054871 37 376.898030 38 192.287465 39 94.550473 40 -146.444414 41 113.175297 42 137.552129 43 314.634697 44 965.640207 45 930.542767 46 960.354261 47 1070.879485 48 144.170580 49 822.500312 50 551.673047 51 488.977249 52 -530.730288 53 -1476.248022 54 -323.818689 55 -1280.107804 56 151.070548 57 394.785178 58 145.719462 59 772.968175 60 305.045522 61 568.126541 62 -393.194801 63 -446.447475 64 -879.906479 65 -1343.505809 66 -1081.662699 67 -530.544446 68 -585.843427 69 155.834546 70 129.348644 71 577.403233 72 236.786258 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1tvnl1256747057.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/2yfku1256747057.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/3crm51256747057.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/4t5w91256747057.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/5hocf1256747057.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/6jau51256747057.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/7rxgv1256747057.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/8b9c41256747057.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. -1208.0 -301.0 93.8 109.5 436.7 1246.0 > > #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/9ev9j1256747057.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/10ygdg1256747057.tab") > > system("convert tmp/1tvnl1256747057.ps tmp/1tvnl1256747057.png") > system("convert tmp/2yfku1256747057.ps tmp/2yfku1256747057.png") > system("convert tmp/3crm51256747057.ps tmp/3crm51256747057.png") > system("convert tmp/4t5w91256747057.ps tmp/4t5w91256747057.png") > system("convert tmp/5hocf1256747057.ps tmp/5hocf1256747057.png") > system("convert tmp/6jau51256747057.ps tmp/6jau51256747057.png") > system("convert tmp/7rxgv1256747057.ps tmp/7rxgv1256747057.png") > system("convert tmp/8b9c41256747057.ps tmp/8b9c41256747057.png") > > > proc.time() user system elapsed 2.637 1.961 3.181