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(6.165417854,6.163314804,6.152732695,6.133398043,6.120297419,6.12249281,6.248042875,6.263398263,6.259581464,6.251903883,6.232448017,6.238324625,6.251903883,6.248042875,6.234410726,6.232448017,6.216606101,6.228511004,6.343880434,6.363028104,6.359573869,6.336825731,6.304448802,6.318968114,6.33150185,6.329720906,6.318968114,6.298949247,6.285998095,6.29710932,6.386879319,6.415096959,6.418364936,6.415096959,6.386879319,6.388561406,6.381816017,6.378426184,6.369900983,6.350885717,6.340359304,6.343880434,6.431331082,6.444131257,6.442540166,6.416732283,6.388561406,6.391917113,6.385194399,6.380122537,6.363028104,6.352629396,6.350885717,6.350885717,6.429719478,6.439350371,6.429719478,6.376726948,6.338594078,6.32256524,6.329720906,6.308098442,6.276643489,6.265301213,6.23636959,6.212606096,6.318968114,6.336825731,6.295266001,6.267200549,6.234410726,6.242223265) > x <- c(363,364,363,358,357,357,380,378,376,380,379,384,392,394,392,396,392,396,419,421,420,418,410,418,426,428,430,424,423,427,441,449,452,462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409) > 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.0079014099 2 -0.0121965391 3 -0.0205865689 4 -0.0289608247 5 -0.0398693694 6 -0.0376739784 7 0.0374582641 8 0.0571978105 9 0.0577651700 10 0.0413192721 11 0.0240554853 12 0.0189716971 13 0.0150143212 14 0.0067691547 15 -0.0024788358 16 -0.0132098618 17 -0.0202834608 18 -0.0171468748 19 0.0478047327 20 0.0625682442 21 0.0613060885 22 0.0429421089 23 0.0281018139 24 0.0250844919 25 0.0200815940 26 0.0139164915 27 -0.0012204589 28 -0.0080868505 29 -0.0188459233 30 -0.0165030152 31 0.0425778744 32 0.0532588805 33 0.0499506198 34 0.0247618504 35 0.0118887651 36 0.0004183766 37 -0.0063270124 38 -0.0141010038 39 -0.0204341256 40 -0.0262969162 41 -0.0346312499 42 -0.0333021992 43 0.0190751810 44 0.0318753560 45 0.0324763442 46 0.0198209367 47 0.0048025351 48 -0.0049942333 49 -0.0182931850 50 -0.0211729678 51 -0.0294990838 52 -0.0333215541 53 -0.0394493916 54 -0.0372573124 55 0.0086952600 56 0.0183261530 57 0.0196556562 58 0.0061205526 59 -0.0100915251 60 -0.0239282838 61 -0.0211567763 62 -0.0296267649 63 -0.0369688462 64 -0.0417348845 65 -0.0531298736 66 -0.0549725752 67 -0.0034125382 68 0.0078688411 69 0.0013823789 70 -0.0135305976 71 -0.0287837867 72 -0.0319316439 > library(lattice) > postscript(file="/var/www/rcomp/tmp/12tvy1256673723.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/23rrk1256673723.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/35fpf1256673723.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/4ndn31256673723.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/5k8h51256673723.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/6nblk1256673723.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/7mu0n1256673723.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/8xz0p1256673723.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. 357.0 402.0 427.5 427.0 460.2 476.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/9azcq1256673723.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/10use81256673723.tab") > > system("convert tmp/12tvy1256673723.ps tmp/12tvy1256673723.png") > system("convert tmp/23rrk1256673723.ps tmp/23rrk1256673723.png") > system("convert tmp/35fpf1256673723.ps tmp/35fpf1256673723.png") > system("convert tmp/4ndn31256673723.ps tmp/4ndn31256673723.png") > system("convert tmp/5k8h51256673723.ps tmp/5k8h51256673723.png") > system("convert tmp/6nblk1256673723.ps tmp/6nblk1256673723.png") > system("convert tmp/7mu0n1256673723.ps tmp/7mu0n1256673723.png") > system("convert tmp/8xz0p1256673723.ps tmp/8xz0p1256673723.png") > > > proc.time() user system elapsed 1.710 1.620 3.273