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(168802,173276,172957,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,163405) > x <- c(105.4,104.4,104.9,106.9,107.6,106.5,106,106.5,105.9,104.3,103.8,102.7,103.2,103.5,104.5,103.5,103.8,102.6,102.1,105.1,106.2,106.5,106.3,107.6,107.4,109.2,108.5,107,107.8,109.7,110.6,110.9,111.7,111.2,110.2,112.5,111.6,111.2,112.6,113.1,111.8,106.3,115,114,113.1,114.9,115.5,113.8,114.7,114.2,112.9,112.1,111.1,109.2,106.6,104.1,103.2,91.2,93.6,93.9,93.8,93.8,93.8,94.3,94.5) > 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 7367.29458 2 10708.32572 3 10955.81015 4 13822.74787 5 14877.82608 6 11474.56033 7 13355.07590 8 14149.56033 9 14571.77901 10 12241.02883 11 8940.54440 12 6836.27866 13 5632.76309 14 10991.65375 15 11285.62261 16 9839.65375 17 9704.54440 18 5697.98177 19 7543.49734 20 11244.40392 21 13161.66967 22 12250.56033 23 11498.96656 24 13025.82608 25 10331.23231 26 16768.57626 27 14385.49805 28 11946.04476 29 6223.41985 30 4712.06069 31 5226.73266 32 7262.62332 33 5887.99841 34 -27.48602 35 -1893.45488 36 -2895.62650 37 -11703.29848 38 -4901.48602 39 -3310.32961 40 -8138.84518 41 -10364.70470 42 -19345.03344 43 -6439.20435 44 -6361.17321 45 -9431.84518 46 -11608.50123 47 -10789.71992 48 -18285.76698 49 -16422.09501 50 -9605.57944 51 -12244.43896 52 -15796.81405 53 -16630.78291 54 -16962.42374 55 -13279.14278 56 -10679.56494 57 -8517.23691 58 -18490.86325 59 -14491.73798 60 -16776.84733 61 -14436.14421 62 -7156.14421 63 -6949.14421 64 -9607.65978 65 -10379.06601 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1rwaa1258035729.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/2owrm1258035729.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/32er11258035729.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/4j7sh1258035729.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/59aaw1258035729.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/6oa4v1258035729.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/7p6k91258035729.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/8c3fv1258035729.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. 91.2 103.8 106.6 106.6 111.2 115.5 > > #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/9m9dh1258035729.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/10kt7k1258035729.tab") > > system("convert tmp/1rwaa1258035729.ps tmp/1rwaa1258035729.png") > system("convert tmp/2owrm1258035729.ps tmp/2owrm1258035729.png") > system("convert tmp/32er11258035729.ps tmp/32er11258035729.png") > system("convert tmp/4j7sh1258035729.ps tmp/4j7sh1258035729.png") > system("convert tmp/59aaw1258035729.ps tmp/59aaw1258035729.png") > system("convert tmp/6oa4v1258035729.ps tmp/6oa4v1258035729.png") > system("convert tmp/7p6k91258035729.ps tmp/7p6k91258035729.png") > system("convert tmp/8c3fv1258035729.ps tmp/8c3fv1258035729.png") > > > proc.time() user system elapsed 1.603 1.162 7.897