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(0.33,0.21,0.02,-0.00,-0.15,-0.21,-0.17,-0.16,-0.44,-0.55,-0.67,-0.78,-0.71,-0.79,-0.78,-0.93,-1.10,-0.91,-0.92,-0.83,-0.34,-0.34,-0.20,-0.14,-0.10,-0.16,-0.21,-0.22,-0.30,-0.13,-0.19,-0.28,-0.18,-0.06,0.22,0.17,-0.13,0.22,0.08,0.57,0.72,0.95,0.59,0.29,0.47,1.08,1.27,1.54,1.99,1.58,1.03,0.35,-0.09,-0.25,-0.70,-0.94,-1.08,-1.43,-1.69,-1.80) > x <- c(-0.06,-0.05,-0.05,-0.03,0.00,0.01,0.02,-0.00,-0.01,0.03,-0.00,-0.06,-0.09,-0.12,-0.11,-0.11,-0.12,-0.11,-0.07,-0.07,-0.07,-0.07,-0.05,-0.03,-0.02,-0.02,-0.00,-0.01,-0.01,0.01,0.02,0.02,0.01,0.03,0.04,0.04,0.03,0.04,0.04,0.03,0.06,0.08,0.09,0.08,0.09,0.10,0.08,0.06,0.05,0.07,0.06,0.03,0.01,-0.01,0.01,0.00,-0.01,0.01,0.04,0.06) > 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.899797847 2 0.705124112 3 0.515124112 4 0.345776642 5 -0.028244562 6 -0.162918297 7 -0.197592032 8 -0.038244562 9 -0.243570827 10 -0.652265767 11 -0.548244562 12 -0.210202153 13 0.083819051 14 0.227840255 15 0.163166521 16 0.013166521 17 -0.082159745 18 0.033166521 19 -0.275528419 20 -0.185528419 21 0.304471581 22 0.304471581 23 0.295124112 24 0.205776642 25 0.171102907 26 0.111102907 27 -0.088244562 28 -0.023570827 29 -0.103570827 30 -0.082918297 31 -0.217592032 32 -0.307592032 33 -0.132918297 34 -0.162265767 35 0.043060499 36 -0.006939501 37 -0.232265767 38 0.043060499 39 -0.096939501 40 0.467734233 41 0.393713029 42 0.474365559 43 0.039691824 44 -0.185634441 45 -0.080308176 46 0.455018090 47 0.794365559 48 1.213713029 49 1.738386764 50 1.179039294 51 0.703713029 52 0.247734233 53 -0.042918297 54 -0.053570827 55 -0.652918297 56 -0.818244562 57 -0.883570827 58 -1.382918297 59 -1.866939501 60 -2.126286971 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ydms1257621350.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/2dgsk1257621350.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/3mwwg1257621350.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/4qf3n1257621350.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/59prl1257621350.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/6vi0y1257621350.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/7vf941257621350.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/8pjwb1257621350.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. -0.1200000 -0.0350000 0.0100000 -0.0001667 0.0400000 0.1000000 > > #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/9el9t1257621350.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/10wds01257621350.tab") > > system("convert tmp/1ydms1257621350.ps tmp/1ydms1257621350.png") > system("convert tmp/2dgsk1257621350.ps tmp/2dgsk1257621350.png") > system("convert tmp/3mwwg1257621350.ps tmp/3mwwg1257621350.png") > system("convert tmp/4qf3n1257621350.ps tmp/4qf3n1257621350.png") > system("convert tmp/59prl1257621350.ps tmp/59prl1257621350.png") > system("convert tmp/6vi0y1257621350.ps tmp/6vi0y1257621350.png") > system("convert tmp/7vf941257621350.ps tmp/7vf941257621350.png") > system("convert tmp/8pjwb1257621350.ps tmp/8pjwb1257621350.png") > > > proc.time() user system elapsed 1.588 1.156 1.990