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(2.006,1.452,0.576,0.448,0.702,0.662,0.588,0.364,0.126,0.132,1.548,1.088,1.284,1.034,0.488,0.646,0.616,0.55,0.384,0.48,0.184,0.368,1.262,0.878,0.98,0.766,0.5,0.428,0.31,0.39,0.376,0.746,0.092,-0.344,-0.086,-0.88,-1.046,-0.68,-0.482,-0.564,-0.93,-1.016,-1.474,-1.834,-1.984,-1.748,-0.312,-0.21,-0.534,-0.594,-1.016,-1.042,-0.644,-0.61,-0.766,-1.068,-1.748,-1.694,-0.676,-0.678) > x <- c(0.864,0.983,0.669,0.577,0.708,0.498,0.537,0.501,0.444,-0.097,0.777,-0.213,0.331,0.956,0.737,1.024,1.029,1.03,1.081,1.525,0.781,0.457,0.198,-0.978,-0.425,0.204,0.355,0.347,0.12,0.14,-0.081,0.424,-0.157,-0.461,0.076,-0.765,-0.614,-0.465,-0.268,-0.241,-0.34,-0.019,-0.356,-0.746,-0.821,-0.767,0.537,0.04,-0.246,-0.536,-0.869,-0.958,-0.211,0.29,0.556,0.653,0.083,0.114,0.941,0.438) > 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.45014907 2 0.79406483 3 0.18742996 4 0.13835223 5 0.27997378 6 0.42012244 7 0.31266626 8 0.11954889 9 -0.06955362 10 0.40054364 11 1.06678208 12 1.45605433 13 1.18538352 14 0.39922680 15 0.04109611 16 -0.04710706 17 -0.08139631 18 -0.14825416 19 -0.35800455 20 -0.64289029 21 -0.30064932 22 0.16129432 23 1.27747767 24 1.90231016 25 1.52991869 26 0.77633057 27 0.38079510 28 0.31565791 29 0.39239003 30 0.45523301 31 0.63081803 32 0.56760340 33 0.41201469 34 0.23680132 35 0.03413546 36 -0.03841205 37 -0.33394751 38 -0.09576728 39 -0.06676388 40 -0.17192585 41 -0.45299862 42 -0.81436872 43 -0.98327301 44 -1.00871121 45 -1.09437241 46 -0.90469635 47 -0.58733374 48 -0.05898191 49 -0.13763659 50 0.05114013 51 -0.08519557 52 -0.03484685 53 -0.27766137 54 -0.67344460 55 -1.05763290 56 -1.44284442 57 -1.63386949 58 -1.60646287 59 -1.29790544 60 -0.86840651 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/13kyl1257342378.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/21llg1257342378.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/3f8vb1257342378.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/4i4v21257342378.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/5ak711257342378.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/6loco1257342378.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/7iaar1257342378.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/83ikg1257342378.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.9780 -0.2515 0.2010 0.1732 0.5960 1.5250 > > #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/97lf41257342378.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/10dy1r1257342378.tab") > > system("convert tmp/13kyl1257342378.ps tmp/13kyl1257342378.png") > system("convert tmp/21llg1257342378.ps tmp/21llg1257342378.png") > system("convert tmp/3f8vb1257342378.ps tmp/3f8vb1257342378.png") > system("convert tmp/4i4v21257342378.ps tmp/4i4v21257342378.png") > system("convert tmp/5ak711257342378.ps tmp/5ak711257342378.png") > system("convert tmp/6loco1257342378.ps tmp/6loco1257342378.png") > system("convert tmp/7iaar1257342378.ps tmp/7iaar1257342378.png") > system("convert tmp/83ikg1257342378.ps tmp/83ikg1257342378.png") > > > proc.time() user system elapsed 1.585 1.156 2.701