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(-13.65,-13.632,-12.474,-11.28,-10.606,-9.914,-9.668,-9.586,-9.968,-9.476,-9.63,-12.182,-12.51,-12.41,-11.818,-10.998,-10.47,-9.45,-9.104,-8.448,-8.284,-8.256,-8.856,-12.372,-13.246,-12.9,-11.388,-10.058,-9.056,-8.792,-8.728,-9.092,-10.058,-9.684,-9.428,-11.342,-10.95,-10.002,-9.282,-8.48,-8.262,-8.208,-7.716,-6.886,-6.366,-5.928,-7.186,-11.662,-12.874,-12.044,-10.63,-8.552,-8.726,-9.876,-10.424,-10.47,-9.932,-9.002,-9.312,-12.01,-12.32) > x <- c(25.5,25.6,23.7,22,21.3,20.7,20.4,20.3,20.4,19.8,19.5,23.1,23.5,23.5,22.9,21.9,21.5,20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.3,19.8,21.2,21.5,20.6,19.1,19.6,23.5,24) > 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.03992285 2 0.04405643 3 -0.05154991 4 0.02080230 5 0.23294733 6 0.52907164 7 0.57713380 8 0.59315451 9 0.27713380 10 0.37325811 11 0.02132026 12 -0.15542560 13 -0.21950848 14 -0.11950848 15 0.07661583 16 0.23682302 17 0.50090589 18 0.86111308 19 1.00917523 20 1.13734098 21 1.16938242 22 0.93346529 23 0.33346529 24 -0.67532201 25 -1.08746704 26 -0.93940488 27 -0.48307339 28 -0.14276261 29 0.13346529 30 0.26550673 31 0.19754817 32 -0.03449327 33 -0.14276261 34 -0.23061758 35 -0.50245183 36 -0.63501123 37 -0.63888692 38 -0.61459686 39 -0.55438968 40 -0.47816177 41 -0.19418249 42 0.05775535 43 0.15387966 44 -0.00580956 45 -0.14560238 46 -0.30141591 47 -0.30580956 48 -0.29521842 49 -0.45154991 50 -0.61123914 51 -0.97867974 52 -0.81407890 53 -0.52622393 54 -0.02674189 55 0.34896805 56 0.50090589 57 0.44509236 58 0.38540314 59 0.40529954 60 0.28049152 61 0.30038793 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1aj5z1257268478.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/2swfj1257268478.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/3ozzx1257268478.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/4cw4o1257268478.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/51hkz1257268478.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/6isa21257268478.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/77au81257268478.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/8f2au1257268478.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. 13.40 18.80 20.20 20.18 22.00 25.60 > > #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/940d01257268478.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/10xk231257268478.tab") > > system("convert tmp/1aj5z1257268478.ps tmp/1aj5z1257268478.png") > system("convert tmp/2swfj1257268478.ps tmp/2swfj1257268478.png") > system("convert tmp/3ozzx1257268478.ps tmp/3ozzx1257268478.png") > system("convert tmp/4cw4o1257268478.ps tmp/4cw4o1257268478.png") > system("convert tmp/51hkz1257268478.ps tmp/51hkz1257268478.png") > system("convert tmp/6isa21257268478.ps tmp/6isa21257268478.png") > system("convert tmp/77au81257268478.ps tmp/77au81257268478.png") > system("convert tmp/8f2au1257268478.ps tmp/8f2au1257268478.png") > > > proc.time() user system elapsed 1.605 1.166 3.460