R version 2.8.1 (2008-12-22) 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(0.040,-0.001,-0.035,-0.016,-0.002,-0.001,0.005,0.017,0.061,0.070,0.058,0.063,0.059,0.078,0.085,0.068,0.079,0.059,0.052,0.025,0.025,0.020,0.010,0.005,0.008,-0.002,-0.019,-0.016,-0.018,-0.028,-0.043,-0.055,-0.050,-0.066,-0.064,-0.073,-0.070,-0.075,-0.065,-0.062,-0.060,-0.075,-0.091,-0.059,-0.041,-0.048,-0.026,0.004,0.042,0.037,-0.017,-0.020,0.002,-0.046,-0.052,-0.100,-0.139,-0.160,-0.144,-0.151) > x <- c(1.319,1.349,1.359,1.352,1.329,1.332,1.332,1.319,1.319,1.309,1.324,1.337,1.337,1.429,1.662,1.702,1.742,1.817,1.987,2.022,2.134,2.262,2.329,2.449,2.575,2.732,2.834,2.885,2.957,3.037,3.107,3.185,3.285,3.345,3.532,3.777,3.857,3.814,3.959,3.799,3.561,3.641,3.884,4.009,3.996,4.228,4.056,4.078,4.471,2.672,1.949,1.514,1.219,0.827,0.490,0.248,0.148,0.131,0.155,0.148) > 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.0536987527 2 0.0128004917 3 -0.0211655953 4 -0.0021893344 5 0.0117326657 6 0.0127428396 7 0.0187428396 8 0.0306987527 9 0.0746987527 10 0.0836648397 11 0.0717157092 12 0.0767597961 13 0.0727597961 14 0.0920717958 15 0.0998619689 16 0.0829976209 17 0.0941332729 18 0.0743876205 19 0.0679641416 20 0.0410828372 21 0.0414626628 22 0.0368967493 23 0.0271239665 24 0.0225309226 25 0.0259582265 26 0.0164906607 27 -0.0001634266 28 0.0030095298 29 0.0012537034 30 -0.0084749925 31 -0.0232376015 32 -0.0349730800 33 -0.0296339499 34 -0.0454304719 35 -0.0427962986 36 -0.0509654299 37 -0.0476941258 38 -0.0528399518 39 -0.0423482132 40 -0.0398908213 41 -0.0386979509 42 -0.0534266468 43 -0.0686025607 44 -0.0361786481 45 -0.0182227350 46 -0.0244359532 47 -0.0030192570 48 0.0270553516 49 0.0663881329 50 0.0552871827 51 -0.0011647278 52 -0.0056399437 53 0.0153596226 54 -0.0339697673 55 -0.0411126357 56 -0.0899333305 57 -0.1292724606 58 -0.1503301127 59 -0.1342487215 60 -0.1412724606 > library(lattice) > postscript(file="/var/www/rcomp/tmp/11yib1257356006.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/rcomp/tmp/28oj41257356006.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/rcomp/tmp/33zq31257356006.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/rcomp/tmp/4drwe1257356006.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/rcomp/tmp/5m2bv1257356006.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/rcomp/tmp/6sfj51257356006.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/rcomp/tmp/7nvbq1257356006.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/rcomp/tmp/8sahl1257356006.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.131 1.332 2.078 2.283 3.392 4.471 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9630v1257356006.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/rcomp/tmp/10hyqe1257356006.tab") > > system("convert tmp/11yib1257356006.ps tmp/11yib1257356006.png") > system("convert tmp/28oj41257356006.ps tmp/28oj41257356006.png") > system("convert tmp/33zq31257356006.ps tmp/33zq31257356006.png") > system("convert tmp/4drwe1257356006.ps tmp/4drwe1257356006.png") > system("convert tmp/5m2bv1257356006.ps tmp/5m2bv1257356006.png") > system("convert tmp/6sfj51257356006.ps tmp/6sfj51257356006.png") > system("convert tmp/7nvbq1257356006.ps tmp/7nvbq1257356006.png") > system("convert tmp/8sahl1257356006.ps tmp/8sahl1257356006.png") > > > proc.time() user system elapsed 2.040 1.770 3.449