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(8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5,8) > x <- c(0.8149,0.8935,0.5820,0.3450,0.4043,0.6149,0.6450,0.6907,0.3545,0.3450,-0.0180,0.3820,0.3993,0.5077,0.5352,0.5450,0.7907,0.9907,1.0907,1.0352,1.0730,0.7907,0.1639,-0.2455,-0.5550,-0.4957,-0.3176,-0.1851,-0.0749,-0.0176,-0.1065,-0.3065,-0.2065,-0.4652,-0.8652,-0.5652,-0.6780,-0.8527,-0.8648,-0.9007,-0.5841,-0.2527,-0.2452,-0.5896,-0.9096,-1.1464,-0.8073,0.2980,0.3708,-0.0236,-0.8644,-1.2760,-0.9180,-0.0749,0.5043,0.5357,0.3514,-0.1173,-0.2618,-0.2627) > 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.013439355 2 0.034840257 3 -0.053663319 4 -0.016666039 5 0.024034641 6 0.013437059 7 -0.016662595 8 -0.062362071 9 -0.026165930 10 -0.016666039 11 -0.053670207 12 -0.053665615 13 -0.070965416 14 -0.079364172 15 -0.006863856 16 -0.016663743 17 -0.062360923 18 -0.062358627 19 -0.062357479 20 -0.006858116 21 -0.044657682 22 -0.062360923 23 -0.035568118 24 -0.026172818 25 -0.016676371 26 0.024024309 27 0.045926354 28 0.013427875 29 0.003229140 30 0.045929798 31 0.034828777 32 0.034826481 33 0.034827629 34 0.093524660 35 0.093520068 36 0.093523512 37 0.106322217 38 0.081020211 39 -0.006879928 40 -0.070980340 41 -0.087576705 42 -0.118972901 43 -0.126472815 44 -0.182076768 45 -0.162080442 46 -0.225283160 47 -0.264379268 48 -0.269666579 49 -0.242465743 50 -0.248070271 51 -0.207279923 52 -0.095684648 53 -0.053680538 54 0.003229140 55 0.024035789 56 0.192636150 57 0.176934034 58 0.345628653 59 0.590126995 60 1.091026984 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1nuzx1257273262.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/22ija1257273262.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/3ixay1257273262.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/40f5n1257273262.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/5kept1257273262.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/68k2u1257273262.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/72c0q1257273262.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/886cm1257273262.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.276e+00 -5.105e-01 -4.925e-02 -3.333e-06 5.146e-01 1.091e+00 > > #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/9ps601257273262.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/10xb531257273262.tab") > > system("convert tmp/1nuzx1257273262.ps tmp/1nuzx1257273262.png") > system("convert tmp/22ija1257273262.ps tmp/22ija1257273262.png") > system("convert tmp/3ixay1257273262.ps tmp/3ixay1257273262.png") > system("convert tmp/40f5n1257273262.ps tmp/40f5n1257273262.png") > system("convert tmp/5kept1257273262.ps tmp/5kept1257273262.png") > system("convert tmp/68k2u1257273262.ps tmp/68k2u1257273262.png") > system("convert tmp/72c0q1257273262.ps tmp/72c0q1257273262.png") > system("convert tmp/886cm1257273262.ps tmp/886cm1257273262.png") > > > proc.time() user system elapsed 1.900 1.670 3.518