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(1.3,1.3,1.2,1.1,1.4,1.2,1.5,1.1,1.3,1.5,1.1,1.4,1.3,1.5,1.6,1.7,1.1,1.6,1.3,1.7,1.6,1.7,1.9,1.8,1.9,1.6,1.5,1.6,1.6,1.7,2,2,1.9,1.7,1.8,1.9,1.7,2,2.1,2.4,2.5,2.5,2.6,2.2,2.5,2.8,2.8,2.9,3,3.1,2.9,2.7,2.2,2.5,2.3,2.6,2.3,2.2,1.8,1.8,2) > 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 1767.4997 2 2029.4997 3 -2181.8305 4 -1789.1607 5 4601.8299 6 1595.1695 7 7240.1601 8 -3711.1607 9 -460.5003 10 1878.1601 11 -1320.1607 12 4003.8299 13 1636.4997 14 5270.1601 15 4677.4903 16 9143.8204 17 -2880.1607 18 8062.4903 19 648.4997 20 8340.8204 21 6340.4903 22 5926.8204 23 14433.4808 24 10789.1506 25 12103.4808 26 -688.5097 27 -6406.8399 28 -4857.5097 29 -3161.5097 30 -3388.1796 31 -2574.1890 32 -3307.1890 33 -8969.5192 34 -20866.1796 35 -11556.8494 36 -9497.5192 37 -19001.1796 38 -13591.1890 39 -14285.8588 40 -5073.8682 41 -1808.5380 42 -3859.5380 43 -6021.2079 44 -14099.5286 45 -13506.5380 46 -6499.5475 47 883.4525 48 1771.7827 49 1180.1129 50 3533.4431 51 1245.7827 52 3766.1223 53 -1073.5286 54 8271.4620 55 7784.8016 56 15227.7921 57 6439.8016 58 6839.4714 59 5902.1506 60 6109.1506 61 6992.8110 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1g9ql1257265974.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/2ei7t1257265974.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/37zpu1257265974.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/4b60x1257265974.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/5bf2q1257265974.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/6a1ls1257265974.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/7396g1257265974.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/8kjod1257265974.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. 1.100 1.500 1.800 1.898 2.300 3.100 > > #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/9v42q1257265974.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/10skbg1257265974.tab") > > system("convert tmp/1g9ql1257265974.ps tmp/1g9ql1257265974.png") > system("convert tmp/2ei7t1257265974.ps tmp/2ei7t1257265974.png") > system("convert tmp/37zpu1257265974.ps tmp/37zpu1257265974.png") > system("convert tmp/4b60x1257265974.ps tmp/4b60x1257265974.png") > system("convert tmp/5bf2q1257265974.ps tmp/5bf2q1257265974.png") > system("convert tmp/6a1ls1257265974.ps tmp/6a1ls1257265974.png") > system("convert tmp/7396g1257265974.ps tmp/7396g1257265974.png") > system("convert tmp/8kjod1257265974.ps tmp/8kjod1257265974.png") > > > proc.time() user system elapsed 2.535 1.879 2.976