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(1.056,0.956,0.348,0.221,0.548,0.748,0.629,0.056,-0.925,-1.487,-1.187,-0.387,0.04,-0.168,-1.106,-1.433,-1.025,-0.717,-0.244,-0.325,-0.598,-0.952,-0.744,-0.644,-0.444,0.556,-0.536,-0.163,-0.206,-0.117,0.137,0.183,0.164,0.064,-0.063,-0.317,-0.444,-0.144,0.283,0.694,1.102,1.048,1.129,1.029,0.721,0.467,0.413,0.259,0.213,0.267,-0.349,-0.084,-0.165,0.27,0.162,0.162,0.016,-0.003,0.224,0.651,0.713) > x <- c(2.074,1.874,1.182,0.434,0.382,0.682,0.626,0.474,0.23,0.342,0.442,1.542,1.69,1.798,0.886,0.538,0.43,0.322,0.374,0.33,0.078,0.182,-0.026,0.774,0.974,0.774,0.066,-0.182,0.286,0.022,-0.082,0.022,-0.034,-0.434,-0.882,-0.678,-0.926,-1.326,-1.178,-0.814,-0.922,-0.918,-1.374,-1.874,-1.966,-2.162,-1.658,-0.254,0.142,-0.362,-0.346,-0.486,-0.03,0.21,0.518,0.318,-0.286,-0.942,-0.894,-0.146,-0.058) > 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 1.39914159 2 1.26523861 3 0.53993432 4 0.28613720 5 0.60432242 6 0.85517689 7 0.72668405 8 0.12791779 9 -0.89444384 10 -1.43745817 11 -1.12050668 12 -0.13404032 13 0.31804788 14 0.12835548 15 -0.96424208 16 -1.35023326 17 -0.96054086 18 -0.67084847 19 -0.18903370 20 -0.27749235 21 -0.59321010 22 -0.92958055 23 -0.75683964 24 -0.52122775 25 -0.28732477 26 0.67877225 27 -0.53324428 28 -0.20228396 29 -0.16595100 30 -0.12170293 31 0.11466752 32 0.17829707 33 0.14980424 34 -0.01800171 35 -0.22094437 36 -0.44036334 37 -0.60940303 38 -0.37720898 39 0.07487922 40 0.54758264 41 0.93727503 42 0.88395309 43 0.88765431 44 0.70289687 45 0.37930150 46 0.09207659 47 0.12351208 48 0.20751097 49 0.22863885 50 0.19720336 51 -0.41608440 52 -0.17481649 53 -0.17851770 54 0.29716587 55 0.24137645 56 0.20747347 57 -0.04091351 58 -0.17111527 59 0.06402145 60 0.61781857 61 0.69473588 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1gy6p1257367138.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/2y9mc1257367138.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/3rp751257367138.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/41hdy1257367138.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/5yntv1257367138.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/6bxi11257367138.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/7jqmz1257367138.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/8tc0c1257367138.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. -2.162000 -0.486000 0.066000 -0.003639 0.442000 2.074000 > > #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/9z6cs1257367138.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/10hit41257367138.tab") > > system("convert tmp/1gy6p1257367138.ps tmp/1gy6p1257367138.png") > system("convert tmp/2y9mc1257367138.ps tmp/2y9mc1257367138.png") > system("convert tmp/3rp751257367138.ps tmp/3rp751257367138.png") > system("convert tmp/41hdy1257367138.ps tmp/41hdy1257367138.png") > system("convert tmp/5yntv1257367138.ps tmp/5yntv1257367138.png") > system("convert tmp/6bxi11257367138.ps tmp/6bxi11257367138.png") > system("convert tmp/7jqmz1257367138.ps tmp/7jqmz1257367138.png") > system("convert tmp/8tc0c1257367138.ps tmp/8tc0c1257367138.png") > > > proc.time() user system elapsed 1.530 1.209 3.015