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(-26.293,-49.202,-52.402,-50.437,-54.537,-60.509,-65.018,-64.09,-63.39,-55.226,-62.226,-56.826,-53.926,-60.472,-57.472,-56.927,-63.227,-57.927,-64.601,-62.901,-58.401,-58.201,-65.401,-57.401,-51.401,-61.001,-58.001,-53.701,-58.101,-54.601,-61.501,-52.201,-58.301,-52.992,-59.874,-55.374,-47.174,-44.42,-50.62,-54.22,-41.32,-47.201,-56.983,-54.992,-46.192,-45.783,-43.383,-46.592,-36.411,-53.782,-53.244,-40.134,-33.096,-43.896,-40.996,-41.768,-47.432,-30.924,-30.76,-41.496,-19.35) > x <- c(-19.339,-46.346,-40.846,-45.051,-48.151,-43.107,-40.914,-54.37,-47.97,-54.798,-49.898,-46.498,-40.098,-54.156,-55.556,-47.321,-52.421,-39.021,-46.823,-53.123,-59.423,-54.923,-46.523,-44.823,-45.823,-49.523,-36.323,-50.523,-44.223,-41.023,-42.323,-60.723,-62.023,-46.916,-46.802,-48.202,-44.802,-43.66,-44.36,-50.36,-41.16,-43.523,-38.309,-47.016,-51.216,-53.309,-50.209,-48.916,-33.453,-34.086,-48.312,-36.482,-37.008,-50.008,-41.308,-51.464,-40.436,-27.452,-35.48,-32.108,-5.15) > 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 7.41489422 2 3.42755653 3 -3.62585713 4 1.28525277 5 -0.64282316 6 -10.14875380 7 -16.19421492 8 -5.83866325 9 -9.62263550 10 3.32520240 11 -7.10783886 12 -4.08994912 13 -5.67392138 14 -2.37059607 15 1.61027286 16 -3.61433832 17 -6.34117292 18 -10.42948984 19 -11.63724741 20 -5.52333722 21 3.39057298 22 0.43777998 23 -12.64743361 24 -5.83848874 25 0.86213193 26 -6.14557161 27 -12.39376439 28 1.85504905 29 -6.95886114 30 -5.70084727 31 -11.69004040 32 10.50137984 33 5.31218671 34 0.03691031 35 -6.92496044 36 -1.44409151 37 4.37379823 38 6.32768943 39 0.61812389 40 1.22184789 41 7.67613776 42 3.45070440 43 -9.98433175 44 -1.89302762 45 9.84957917 46 11.72497823 47 11.95305416 48 7.83815164 49 7.18545430 50 -9.74205282 51 0.76297676 52 5.58463429 53 12.99116076 54 11.29922941 55 8.10382962 56 14.44733310 57 1.05688840 58 8.46802968 59 14.25661238 60 1.15811950 61 4.41678760 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1mbhr1257773860.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/2it5q1257773860.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/3rco21257773860.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/4eptu1257773860.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/55l7v1257773860.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/6xeyd1257773860.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/7h2l51257773860.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/810xx1257773860.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. -62.02 -50.21 -46.50 -44.84 -40.91 -5.15 > > #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/9ank11257773860.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/10kzae1257773861.tab") > > system("convert tmp/1mbhr1257773860.ps tmp/1mbhr1257773860.png") > system("convert tmp/2it5q1257773860.ps tmp/2it5q1257773860.png") > system("convert tmp/3rco21257773860.ps tmp/3rco21257773860.png") > system("convert tmp/4eptu1257773860.ps tmp/4eptu1257773860.png") > system("convert tmp/55l7v1257773860.ps tmp/55l7v1257773860.png") > system("convert tmp/6xeyd1257773860.ps tmp/6xeyd1257773860.png") > system("convert tmp/7h2l51257773860.ps tmp/7h2l51257773860.png") > system("convert tmp/810xx1257773860.ps tmp/810xx1257773860.png") > > > proc.time() user system elapsed 2.604 1.952 3.036