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(79,106,101,104,97,93,99,116,104,99,109,93,91,111,105,114,103,105,106,125,103,114,123,102,101,121,120,119,102,118,114,130,113,119,129,116,110,124,133,129,105,127,127,128,133,122,141,127,110,136,132,110,97,96,98,106,98,94,107,98) > x <- c(82,106,97,102,102,91,101,117,102,101,109,89,95,114,103,120,116,109,111,132,106,115,119,104,107,123,120,124,106,116,115,133,112,118,126,116,112,124,136,134,118,128,130,133,137,122,145,128,115,136,134,117,102,95,98,109,99,94,109,98) > 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 -3.0591174 2 1.5080755 3 4.9203782 4 3.2468767 5 -3.7531233 6 2.5285799 7 -0.8184230 8 1.2263723 9 3.2468767 10 -0.8184230 11 1.7039747 12 4.3979805 13 -3.2102212 14 -0.9695268 15 3.3121764 16 -3.5777286 17 -10.8389274 18 -2.2960253 19 -3.1654259 20 -3.7941321 21 -1.4919245 22 1.0957729 23 6.3569717 24 -0.6225239 25 -4.4266248 26 0.6181706 27 2.4222714 28 -2.3165297 29 -2.4919245 30 4.1610726 31 1.0957729 32 0.2711676 33 2.8998738 34 3.2916720 35 5.8140697 36 2.1610726 37 -0.1001262 38 2.6834703 39 0.4670667 40 -1.6635327 41 -10.7083280 42 1.9446691 43 0.0752685 44 -1.7288324 45 -0.4676336 46 2.5528708 47 0.0547641 48 1.9446691 49 -2.9042271 50 3.4670667 51 1.3364673 52 -4.7736277 53 -3.7531233 54 1.7897788 55 0.9856779 56 -1.2960253 57 0.0509776 58 0.7244791 59 -0.2960253 60 0.9856779 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1e91a1257362360.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/28vzv1257362360.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/3fx261257362360.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/4fnsn1257362360.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/5998o1257362360.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/6hsex1257362360.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/73gyo1257362360.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/8vd081257362360.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. 82.0 102.0 114.5 113.5 123.2 145.0 > > #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/9gw4u1257362360.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/10qyjm1257362360.tab") > > system("convert tmp/1e91a1257362360.ps tmp/1e91a1257362360.png") > system("convert tmp/28vzv1257362360.ps tmp/28vzv1257362360.png") > system("convert tmp/3fx261257362360.ps tmp/3fx261257362360.png") > system("convert tmp/4fnsn1257362360.ps tmp/4fnsn1257362360.png") > system("convert tmp/5998o1257362360.ps tmp/5998o1257362360.png") > system("convert tmp/6hsex1257362360.ps tmp/6hsex1257362360.png") > system("convert tmp/73gyo1257362360.ps tmp/73gyo1257362360.png") > system("convert tmp/8vd081257362360.ps tmp/8vd081257362360.png") > > > proc.time() user system elapsed 1.642 1.186 4.351