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(0.6348,0.634,0.62915,0.62168,0.61328,0.6089,0.60857,0.62672,0.62291,0.62393,0.61838,0.62012,0.61659,0.6116,0.61573,0.61407,0.62823,0.64405,0.6387,0.63633,0.63059,0.62994,0.63709,0.64217,0.65711,0.66977,0.68255,0.68902,0.71322,0.70224,0.70045,0.69919,0.69693,0.69763,0.69278,0.70196,0.69215,0.6769,0.67124,0.66532,0.67157,0.66428,0.66576,0.66942,0.6813,0.69144,0.69862,0.695,0.69867,0.68968,0.69233,0.68293,0.68399,0.66895,0.68756,0.68527,0.6776,0.68137,0.67933,0.67922) > x <- c(1.5291,1.5358,1.5355,1.5287,1.5334,1.5225,1.5135,1.5144,1.4913,1.4793,1.4663,1.4749,1.4745,1.4775,1.4678,1.4658,1.4572,1.4721,1.4624,1.4636,1.4649,1.465,1.4673,1.4679,1.4621,1.4674,1.4695,1.4964,1.5155,1.5411,1.5476,1.54,1.5474,1.5485,1.559,1.5544,1.5657,1.5734,1.567,1.5547,1.54,1.5192,1.527,1.5387,1.5431,1.5426,1.5216,1.5364,1.5469,1.5501,1.5494,1.5475,1.5448,1.5391,1.5578,1.5528,1.5496,1.549,1.5449,1.5479) > 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.0323520338 2 -0.0369122919 3 -0.0415939221 4 -0.0452475408 5 -0.0562853338 6 -0.0545478990 7 -0.0498268061 8 -0.0321819154 9 -0.0230274436 10 -0.0152726530 11 -0.0135266299 12 -0.0166132298 13 -0.0199187368 14 -0.0265924345 15 -0.0170184788 16 -0.0175560137 17 0.0014305862 18 0.0088882213 19 0.0089821770 20 0.0059386979 21 -0.0005309044 22 -0.0012370276 23 0.0046221375 24 0.0093653980 25 0.0275605467 26 0.0372460143 27 0.0488474259 28 0.0402202704 29 0.0537007288 30 0.0283531756 31 0.0229151641 32 0.0259205314 33 0.0195074106 34 0.0195900548 35 0.0088471131 36 0.0206087828 37 0.0044568550 38 -0.0151146356 39 -0.0171827473 40 -0.0161995870 41 -0.0016994686 42 0.0026841684 43 -0.0002134455 44 -0.0031198663 45 0.0062907105 46 0.0167113268 47 0.0356772103 48 0.0237509686 49 0.0215280269 50 0.0107420827 51 0.0137849455 52 0.0054512873 53 0.0080266152 54 -0.0038143593 55 0.0043005921 56 0.0048167549 57 -0.0010573010 58 0.0030494385 59 0.0033104920 60 0.0015167943 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/12bwm1256678510.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/2fdbs1256678510.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/3iqfu1256678510.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/46npd1256678510.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/5vwxh1256678510.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/63i1x1256678510.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/79k661256678510.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/8zc5g1256678510.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.457 1.475 1.534 1.518 1.548 1.573 > > #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/9i6l51256678510.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/102ajr1256678510.tab") > > system("convert tmp/12bwm1256678510.ps tmp/12bwm1256678510.png") > system("convert tmp/2fdbs1256678510.ps tmp/2fdbs1256678510.png") > system("convert tmp/3iqfu1256678510.ps tmp/3iqfu1256678510.png") > system("convert tmp/46npd1256678510.ps tmp/46npd1256678510.png") > system("convert tmp/5vwxh1256678510.ps tmp/5vwxh1256678510.png") > system("convert tmp/63i1x1256678510.ps tmp/63i1x1256678510.png") > system("convert tmp/79k661256678510.ps tmp/79k661256678510.png") > system("convert tmp/8zc5g1256678510.ps tmp/8zc5g1256678510.png") > > > proc.time() user system elapsed 2.704 2.082 3.073