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.987874348,2.028148247,2.014903021,2.028148247,2.066862759,2.066862759,2.091864062,2.104134154,2.079441542,2.014903021,1.916922612,1.871802177,1.887069649,2.028148247,2.079441542,2.091864062,2.041220329,2.014903021,2.028148247,2.054123734,2.054123734,2.054123734,2.014903021,2.014903021,1.960094784,2.014903021,2.014903021,2.028148247,2.041220329,2.041220329,2.066862759,2.091864062,2.104134154,2.104134154,2.104134154,2.066862759,1.987874348,1.931521412,1.887069649,1.902107526,1.931521412,1.945910149,1.960094784,1.974081026,1.960094784,1.931521412,1.945910149,1.916922612,1.85629799,1.902107526,1.887069649,1.85629799,1.840549633,1.824549292,1.871802177,1.916922612,1.916922612,1.85629799,1.808288771,1.757857918,1.808288771,1.974081026,1.987874348,1.931521412,1.808288771,1.757857918,1.824549292,1.960094784,2.041220329,2.066862759,2.041220329,2.00148,2.014903021) > x <- c(2.066862759,2.208274414,2.240709689,2.240709689,2.208274414,2.197224577,2.2300144,2.292534757,2.282382386,2.2300144,2.116255515,2.079441542,2.140066163,2.341805806,2.406945108,2.388762789,2.302585093,2.219203484,2.219203484,2.251291799,2.261763098,2.251291799,2.208274414,2.186051277,2.197224577,2.312535424,2.332143895,2.32238772,2.261763098,2.219203484,2.2300144,2.240709689,2.240709689,2.219203484,2.197224577,2.197224577,2.197224577,2.282382386,2.302585093,2.282382386,2.2300144,2.197224577,2.197224577,2.208274414,2.208274414,2.208274414,2.219203484,2.174751721,2.116255515,2.128231706,2.091864062,2.041220329,2.066862759,2.066862759,2.079441542,2.066862759,2.028148247,1.960094784,1.916922612,1.871802177,1.931521412,2.104134154,2.163323026,2.116255515,2.066862759,2.014903021,2.054123734,2.116255515,2.128231706,2.104134154,2.041220329,1.974081026,1.987874348) > 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.0713049890 2 0.0343778751 3 0.0034252255 4 0.0166704515 5 0.0730923871 6 0.0791248362 7 0.0862251568 8 0.0643634449 9 0.0452133274 10 0.0092641158 11 -0.0266117860 12 -0.0516343301 13 -0.0694637210 14 -0.0385210575 15 -0.0227893299 16 -0.0004405174 17 -0.0040371706 18 0.0151661305 19 0.0284113565 20 0.0368688361 21 0.0311522289 22 0.0368688361 23 0.0211326491 24 0.0332649496 25 -0.0276431388 26 -0.0357866732 27 -0.0464915463 28 -0.0279201215 29 0.0182488239 30 0.0414834385 31 0.0612238538 32 0.0803862665 33 0.0926563585 34 0.1043972635 35 0.1163962312 36 0.0791248362 37 0.0001364252 38 -0.1027068026 39 -0.1581878506 40 -0.1321206886 41 -0.0741174932 42 -0.0418277738 43 -0.0276431388 44 -0.0196893459 45 -0.0336755879 46 -0.0622489599 47 -0.0538267415 48 -0.0585466810 49 -0.0872364080 50 -0.0479650465 51 -0.0431486975 52 -0.0462723703 53 -0.0760197260 54 -0.0920200670 55 -0.0516343301 56 0.0003532530 57 0.0214887071 58 -0.0019834166 59 -0.0264236065 60 -0.0522218132 61 -0.0343935447 62 0.0371640553 63 0.0186443345 64 -0.0120129860 65 -0.1082805880 66 -0.1303450068 67 -0.0850654377 68 0.0165603860 69 0.0911477565 70 0.1299457883 71 0.1386499687 72 0.1355630697 73 0.1414558880 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1rv1l1256749915.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/2k67u1256749915.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/343tz1256749915.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/4avyu1256749915.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/5jn1b1256749915.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/6u1sr1256749915.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/7pn2f1256749915.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/8d93l1256749915.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.872 2.092 2.197 2.171 2.241 2.407 > > #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/9rz7v1256749915.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/10wgbr1256749915.tab") > > system("convert tmp/1rv1l1256749915.ps tmp/1rv1l1256749915.png") > system("convert tmp/2k67u1256749915.ps tmp/2k67u1256749915.png") > system("convert tmp/343tz1256749915.ps tmp/343tz1256749915.png") > system("convert tmp/4avyu1256749915.ps tmp/4avyu1256749915.png") > system("convert tmp/5jn1b1256749915.ps tmp/5jn1b1256749915.png") > system("convert tmp/6u1sr1256749915.ps tmp/6u1sr1256749915.png") > system("convert tmp/7pn2f1256749915.ps tmp/7pn2f1256749915.png") > system("convert tmp/8d93l1256749915.ps tmp/8d93l1256749915.png") > > > proc.time() user system elapsed 1.631 1.197 2.359