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(3.242592,3.165475,3.091042,3.058707,3.030134,3.015535,3.010621,3.015535,2.985682,2.970414,3.139833,3.157,3.157,3.131137,3.086487,3.068053,3.020425,3.005683,2.965273,2.95491,2.933857,2.933857,3.11795,3.148453,3.135494,3.063391,2.99072,2.933857,2.923162,2.912351,2.923162,2.99072,2.95491,2.912351,3.049273,3.020425,2.949688,2.895912,2.833213,2.839078,2.85647,2.821379,2.727853,2.66026,2.595255,2.727853,3.095578,3.165475,3.100092,2.970414,2.809403,2.850707,2.985682,3.054001,3.068053,3.025291,2.949688,2.97553,3.157,3.178054) > x <- c(2.00148,1.960095,1.916923,1.931521,1.974081,2.00148,1.987874,1.931521,1.931521,1.916923,1.960095,1.974081,1.960095,1.94591,1.931521,1.960095,1.987874,2.014903,2.014903,2.014903,1.987874,1.94591,1.902108,1.871802,1.871802,1.871802,1.88707,1.916923,1.931521,1.931521,1.916923,1.916923,1.871802,1.808289,1.808289,1.774952,1.740466,1.774952,1.774952,1.808289,1.84055,1.824549,1.774952,1.740466,1.686399,1.722767,1.824549,1.84055,1.791759,1.722767,1.704748,1.774952,1.871802,1.916923,1.916923,1.871802,1.824549,1.824549,1.871802,1.902108) > 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.148176261 2 0.106416146 3 0.068866737 4 0.024060073 5 -0.040873661 6 -0.078880739 7 -0.072170581 8 -0.019111927 9 -0.048964927 10 -0.051761263 11 0.080774146 12 0.085992339 13 0.097941146 14 0.084196967 15 0.051840073 16 0.008994146 17 -0.062366581 18 -0.100200552 19 -0.140610552 20 -0.150973552 21 -0.148934581 22 -0.113083033 23 0.108431792 24 0.164826438 25 0.151867438 26 0.079764438 27 -0.005950634 28 -0.088318263 29 -0.111484927 30 -0.122295927 31 -0.099013263 32 -0.031455263 33 -0.028716562 34 -0.017013830 35 0.119908170 36 0.119541322 37 0.078267111 38 -0.004971678 39 -0.067670678 40 -0.090286830 41 -0.100456711 42 -0.121877407 43 -0.173030678 44 -0.211160889 45 -0.229974258 46 -0.128446916 47 0.152321593 48 0.208548289 49 0.184849420 50 0.114114084 51 -0.031502553 52 -0.050176678 53 0.002055438 54 0.031825737 55 0.045877737 56 0.041664438 57 0.006431593 58 0.032273593 59 0.173373438 60 0.168535792 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1w2b31259336599.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/2ms0f1259336599.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/3brul1259336599.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/41s9h1259336599.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/5ch3b1259336599.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/6hdbn1259336599.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/7o7271259336599.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/8bpf21259336599.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.686 1.820 1.902 1.881 1.946 2.015 > > #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/9b6bv1259336599.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/10v4ya1259336599.tab") > > system("convert tmp/1w2b31259336599.ps tmp/1w2b31259336599.png") > system("convert tmp/2ms0f1259336599.ps tmp/2ms0f1259336599.png") > system("convert tmp/3brul1259336599.ps tmp/3brul1259336599.png") > system("convert tmp/41s9h1259336599.ps tmp/41s9h1259336599.png") > system("convert tmp/5ch3b1259336599.ps tmp/5ch3b1259336599.png") > system("convert tmp/6hdbn1259336599.ps tmp/6hdbn1259336599.png") > system("convert tmp/7o7271259336599.ps tmp/7o7271259336599.png") > system("convert tmp/8bpf21259336599.ps tmp/8bpf21259336599.png") > > > proc.time() user system elapsed 1.608 1.178 2.407