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.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,2.079441542) > x <- c(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,2.091864062) > 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.010067285 2 0.011520669 3 0.004317821 4 0.020031933 5 0.033277159 6 0.043077407 7 0.037798982 8 0.043077407 9 0.025541113 10 0.036743464 11 -0.023697066 12 -0.027015299 13 -0.036899636 14 -0.018736468 15 0.024895577 16 0.046349241 17 0.066542050 18 0.086152018 19 0.098422110 20 0.109263066 21 0.120342304 22 0.083070909 23 0.004082498 24 -0.095197214 25 -0.149832859 26 -0.124611100 27 -0.068799297 28 -0.037881701 29 -0.023697066 30 -0.015280882 31 -0.029267124 32 -0.057840496 33 -0.048960939 34 -0.055541008 35 -0.086678570 36 -0.046906052 37 -0.043611545 38 -0.048854457 39 -0.077528779 40 -0.093529120 41 -0.052617011 42 -0.001155800 43 0.018359606 44 -0.007960285 45 -0.034207060 46 -0.061893378 47 -0.041566096 48 0.037214663 49 0.021171761 50 -0.011455148 51 -0.109789641 52 -0.134028368 53 -0.087107568 54 0.017118224 55 0.092206751 56 0.129996396 57 0.136067882 58 0.130171470 59 0.136641484 60 0.148760348 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1xa5w1256918561.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/2lueh1256918561.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/3e2t71256918561.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/4l03a1256918561.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/5qzy41256918561.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/6zem81256918561.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/70tqb1256918561.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/8wto41256918561.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.076 2.197 2.162 2.233 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/9ezzk1256918561.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/106w8o1256918561.tab") > > system("convert tmp/1xa5w1256918561.ps tmp/1xa5w1256918561.png") > system("convert tmp/2lueh1256918561.ps tmp/2lueh1256918561.png") > system("convert tmp/3e2t71256918561.ps tmp/3e2t71256918561.png") > system("convert tmp/4l03a1256918561.ps tmp/4l03a1256918561.png") > system("convert tmp/5qzy41256918561.ps tmp/5qzy41256918561.png") > system("convert tmp/6zem81256918561.ps tmp/6zem81256918561.png") > system("convert tmp/70tqb1256918561.ps tmp/70tqb1256918561.png") > system("convert tmp/8wto41256918561.ps tmp/8wto41256918561.png") > > > proc.time() user system elapsed 1.621 1.188 2.593