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(173558,173820,171663,174110,174338,175440,174922,172188,171330,169560,174579,173740,173427,172952,170305,172717,173019,173690,172439,171914,171968,169500,173898,172308,171568,164939,161275,160770,162466,160185,154836,154103,150495,142707,149962,149967,144572,143819,141070,144119,145330,143279,139063,139202,133632,134476,141859,140693,138047,138346,140167,146796,152228,155410,159032,160312,157687,160141,167421,167628,164403) > x <- c(104988.5,105250.5,103093.55,105540.6,105768.45,106870.55,106352.4,103618.6,102760.5,100990.4,106009.6,105170.45,104857.5,104382.4,101735.35,104147.3,104449.6,105120.35,103869.5,103344.3,103398.35,100930.3,105328.2,103738.25,102998.2,96369.35,92705.4,92200.35,93896.35,91615.3,86266.15,85533.15,81925.2,74137.3,81392.25,81397.2,76002.3,75249.15,72500.1,75548.95,76759.9,74708.9,70492.85,70632.05,65061.9,65905.75,73288.75,72122.7,69476.65,69775.6,71596.7,78225.8,83658.05,86839.9,90462,91741.85,89117,91571.05,98851.25,99058.25,95833.15) > 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.0700403648 2 -0.0657705049 3 -0.1509226984 4 -0.1610426941 5 -0.0073293826 6 -0.0893682651 7 0.0521873533 8 -0.1923658662 9 -0.1063504729 10 -0.0351981039 11 -0.1533993186 12 -0.0170750938 13 -0.0721752950 14 0.0200819167 15 0.0269424773 16 0.1162504507 17 -0.1788229131 18 0.0821084177 19 -0.0882769048 20 0.1031638184 21 0.0540446808 22 0.0638224358 23 0.2354957857 24 0.1595840909 25 0.1975233659 26 -0.0605081686 27 -0.1702202062 28 -0.1284510949 29 -0.1008110846 30 -0.0879857577 31 -0.0251617961 32 -0.0371076261 33 -0.1459070218 34 -0.3728277980 35 -0.2045926017 36 -0.1545119307 37 -0.3424335650 38 -0.2047077830 39 -0.1995095344 40 0.0001781103 41 0.0699131755 42 0.0364876677 43 0.0177779593 44 -0.1799534738 45 -0.1207311882 46 0.0430211837 47 0.1633432334 48 0.1943399114 49 0.2012167691 50 0.2560888099 51 0.1857675969 52 0.1938032056 53 0.0323335394 54 0.2341887086 55 0.1932187094 56 0.3640766499 57 0.1712990078 58 0.1612930923 59 0.0799397923 60 0.0833133077 61 0.1307532857 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/18wci1257265742.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/23cpb1257265742.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/3ezzs1257265742.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/46dic1257265742.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/5smy21257265742.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/6pk6h1257265742.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/76vc31257265742.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/8rciz1257265742.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. 65060 76760 92710 90930 103700 106900 > > #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/9ffgk1257265742.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/10lyt21257265742.tab") > > system("convert tmp/18wci1257265742.ps tmp/18wci1257265742.png") > system("convert tmp/23cpb1257265742.ps tmp/23cpb1257265742.png") > system("convert tmp/3ezzs1257265742.ps tmp/3ezzs1257265742.png") > system("convert tmp/46dic1257265742.ps tmp/46dic1257265742.png") > system("convert tmp/5smy21257265742.ps tmp/5smy21257265742.png") > system("convert tmp/6pk6h1257265742.ps tmp/6pk6h1257265742.png") > system("convert tmp/76vc31257265742.ps tmp/76vc31257265742.png") > system("convert tmp/8rciz1257265742.ps tmp/8rciz1257265742.png") > > > proc.time() user system elapsed 2.604 1.953 4.135