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.93,-1.19,-1.46,-0.91,-0.23,-0.61,-0.55,-0.91,-1.08,-0.07,-0.42,-0.76,-0.74,-0.24,0.58,0.31,0.21,0.34,0.51,0.79,1.04,0.13,0.00,0.39,0.12,0.10,-0.77,-0.23,-0.27,-0.27,-0.57,-0.44,-0.86,-1.21,-0.78,-0.60,-0.86,-0.80,-0.91,-0.90,-1.26,-1.25,-1.31,-1.54,-1.20,-0.29,0.48,0.66,1.08,0.98,1.93,1.47,2.71,3.27,3.57,3.13,3.08,2.63,1.37,1.19,1.08,1.12,-0.02,0.15,-0.79,-1.53,-2.43,-1.47,-1.80) > x <- c(-0.73,-0.78,-0.83,-0.94,-0.95,-0.94,-0.97,-1.15,-1.13,-1.06,-1.02,-0.97,-1.03,-0.89,-0.66,-0.56,-0.56,-0.76,-0.64,-0.58,-0.47,-0.55,-0.72,-0.58,-0.74,-0.75,-0.75,-0.60,-0.77,-0.42,-0.45,-0.10,-0.05,0.02,0.19,0.39,0.59,0.57,0.64,0.75,0.84,1.00,1.06,0.97,1.07,1.15,1.20,1.18,1.20,1.06,1.16,1.05,1.22,1.12,1.45,1.55,1.45,1.35,1.04,0.61,0.52,0.38,0.15,-0.15,-0.40,-0.44,-0.58,-0.61,-0.64) > 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.36561520 2 -0.58700608 3 -0.81839695 4 -0.18345689 5 0.50426494 6 0.11654311 7 0.19970859 8 -0.02129857 9 -0.20674222 10 0.74920501 11 0.36831771 12 -0.01029141 13 0.05603953 14 0.44793399 15 1.09033203 16 0.74311379 17 0.64311379 18 0.92755027 19 1.00488838 20 1.23855744 21 1.40361737 22 0.55539196 23 0.55666298 24 0.83855744 25 0.69210663 26 0.67982845 27 -0.19017155 28 0.23400108 29 0.32527210 30 0.05500825 31 -0.22182628 32 -0.36209014 33 -0.82069926 34 -1.22475203 35 -0.92602304 36 -0.90045953 37 -1.31489602 38 -1.23945237 39 -1.40350514 40 -1.47844521 41 -1.90794163 42 -2.02149082 43 -2.12782177 44 -2.28832535 45 -2.02554359 46 -1.17731818 47 -0.44592731 48 -0.25048366 49 0.15407269 50 0.16217823 51 1.03495999 52 0.65990006 53 1.76862904 54 2.40584729 55 2.45102708 56 1.93380884 57 1.96102708 58 1.58824533 59 0.56762188 60 0.71966033 61 0.67915675 62 0.82726229 63 -0.13513575 64 0.26651899 65 -0.48043540 66 -1.18954811 67 -1.98144256 68 -0.99827709 69 -1.30511162 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1zjm81257176078.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/23n6b1257176078.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/3jrux1257176078.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/4p8fu1257176078.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/5vqab1257176078.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/6o7as1257176078.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/7pdwd1257176078.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/8y37c1257176078.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.1500000 -0.7400000 -0.4200000 0.0001449 0.9700000 1.5500000 > > #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/91z4k1257176078.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/10oirs1257176078.tab") > > system("convert tmp/1zjm81257176078.ps tmp/1zjm81257176078.png") > system("convert tmp/23n6b1257176078.ps tmp/23n6b1257176078.png") > system("convert tmp/3jrux1257176078.ps tmp/3jrux1257176078.png") > system("convert tmp/4p8fu1257176078.ps tmp/4p8fu1257176078.png") > system("convert tmp/5vqab1257176078.ps tmp/5vqab1257176078.png") > system("convert tmp/6o7as1257176078.ps tmp/6o7as1257176078.png") > system("convert tmp/7pdwd1257176078.ps tmp/7pdwd1257176078.png") > system("convert tmp/8y37c1257176078.ps tmp/8y37c1257176078.png") > > > proc.time() user system elapsed 1.643 1.183 2.257