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(1.00,1.00,0.99,0.97,0.96,0.96,1.09,1.10,1.10,1.09,1.07,1.08,1.09,1.09,1.07,1.07,1.05,1.06,1.20,1.22,1.21,1.19,1.15,1.17,1.18,1.18,1.17,1.14,1.13,1.14,1.25,1.28,1.29,1.28,1.25,1.25,1.24,1.24,1.23,1.20,1.19,1.20,1.30,1.32,1.32,1.29,1.25,1.25,1.25,1.24,1.22,1.21,1.20,1.20,1.30,1.31,1.30,1.23,1.19,1.17) > x <- c(1169,2154,2249,2687,4359,5382,4459,6398,4596,3024,1887,2070,1351,2218,2461,3028,4784,4975,4607,6249,4809,3157,1910,2228,1594,2467,2222,3607,4685,4962,5770,5480,5000,3228,1993,2288,1580,2111,2192,3601,4665,4876,5813,5589,5331,3075,2002,2306,1507,1992,2487,3490,4647,5594,5611,5788,6204,3013,1931,2549) > 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.138809099 2 -0.152839369 3 -0.164192542 4 -0.190431382 5 -0.224247230 6 -0.238818769 7 -0.095671623 8 -0.113290600 9 -0.087623042 10 -0.075231586 11 -0.079036240 12 -0.071642879 13 -0.051401494 14 -0.063750980 15 -0.087212255 16 -0.095288562 17 -0.140300900 18 -0.133021490 19 0.012220275 20 0.008831745 21 0.019343002 22 0.022873971 23 0.000636150 24 0.016106581 25 0.035137231 26 0.022702282 27 0.016192044 28 -0.033535796 29 -0.058890751 30 -0.052836319 31 0.045654587 32 0.079785326 33 0.096622411 34 0.111862652 35 0.099453904 36 0.095251945 37 0.095336646 38 0.087773120 39 0.076619362 40 0.026549667 41 0.001394127 42 0.008388659 43 0.095042098 44 0.118232738 45 0.121907671 46 0.124041973 47 0.099325709 48 0.094995554 49 0.106376453 50 0.089468148 51 0.062417403 52 0.038130743 53 0.011650518 54 -0.001838482 55 0.097919371 56 0.105398196 57 0.089472722 58 0.064925097 59 0.040337027 60 0.011534280 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ryak1257354995.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/2kv881257354995.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/3c77g1257354995.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/41vb21257354995.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/5vm2k1257354995.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/6dzwn1257354995.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/7z3df1257354995.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/8pg8q1257354995.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. 1169 2212 3116 3558 4898 6398 > > #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/9okj71257354995.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/10ran81257354995.tab") > > system("convert tmp/1ryak1257354995.ps tmp/1ryak1257354995.png") > system("convert tmp/2kv881257354995.ps tmp/2kv881257354995.png") > system("convert tmp/3c77g1257354995.ps tmp/3c77g1257354995.png") > system("convert tmp/41vb21257354995.ps tmp/41vb21257354995.png") > system("convert tmp/5vm2k1257354995.ps tmp/5vm2k1257354995.png") > system("convert tmp/6dzwn1257354995.ps tmp/6dzwn1257354995.png") > system("convert tmp/7z3df1257354995.ps tmp/7z3df1257354995.png") > system("convert tmp/8pg8q1257354995.ps tmp/8pg8q1257354995.png") > > > proc.time() user system elapsed 1.631 1.206 9.382