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(5.7,6.1,6,5.9,5.8,5.7,5.6,5.4,5.4,5.5,5.6,5.7,5.9,6.1,6,5.8,5.8,5.7,5.5,5.3,5.2,5.2,5,5.1,5.1,5.2,4.9,4.8,4.5,4.5,4.4,4.4,4.2,4.1,3.9,3.8,3.9,4.2,4.1,3.8,3.6,3.7,3.5,3.4,3.1,3.1,3.1,3.2,3.3,3.5,3.6,3.5,3.3,3.2,3.1,3.2,3,3,3.1,3.4) > x <- c(9473.13,9582.45,9739.72,9802.98,9836.67,9692.4,9629.5,9660.92,9820.81,9852.55,9771.32,9613.8,9708.16,9868.44,10028.02,10060.09,10044.05,9980.01,9916.18,9980.01,10156.61,10156.61,10092.21,10012,10056.08,10156.61,10318.5,10416.24,10408.08,10338.82,10265.74,10365.28,10465.29,10428.49,10424.41,10353.06,10302.25,10436.67,10706.04,10826.4,10834.73,10722.6,10561.67,10586.35,10732.96,10766.14,10799.37,10681.22,10675.02,10857.64,11117.59,11195.76,11289.06,11223.28,11197.87,11227.52,11340.12,11303.94,11210.57,11039.7) > 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.472410882 2 0.130358406 3 0.322066474 4 0.339402599 5 0.301891598 6 -0.065703767 7 -0.282372155 8 -0.424093606 9 -0.127525901 10 0.031346192 11 -0.019321108 12 -0.211492882 13 0.163528249 14 0.660819335 15 0.856812045 16 0.716296230 17 0.686544863 18 0.467761976 19 0.149368602 20 0.067761976 21 0.295323779 22 0.295323779 23 -0.024126844 24 -0.072902225 25 0.008858388 26 0.295323779 27 0.295601131 28 0.376891565 29 0.061756206 30 -0.066708859 31 -0.302259349 32 -0.117630233 33 -0.132129350 34 -0.300386849 35 -0.507954528 36 -0.740296174 37 -0.734539748 38 -0.185214394 39 0.214419371 40 0.137665909 41 -0.046883413 42 -0.154864755 43 -0.653361476 44 -0.707584436 45 -0.735648785 46 -0.674105746 47 -0.612469966 48 -0.731617345 49 -0.643117249 50 -0.104389410 51 0.477771919 52 0.522763460 53 0.495818479 54 0.273808199 55 0.126677138 56 0.281672650 57 0.290525759 58 0.223418250 59 0.150233394 60 0.133299729 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/160hx1256673290.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/2u9y71256673290.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/35djs1256673290.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/4h27x1256673290.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/5mfho1256673290.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/618yf1256673290.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/7k1c21256673290.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/84fqd1256673290.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. 9473 9964 10350 10370 10740 11340 > > #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/93jsx1256673290.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/10c6h41256673290.tab") > > system("convert tmp/160hx1256673290.ps tmp/160hx1256673290.png") > system("convert tmp/2u9y71256673290.ps tmp/2u9y71256673290.png") > system("convert tmp/35djs1256673290.ps tmp/35djs1256673290.png") > system("convert tmp/4h27x1256673290.ps tmp/4h27x1256673290.png") > system("convert tmp/5mfho1256673290.ps tmp/5mfho1256673290.png") > system("convert tmp/618yf1256673290.ps tmp/618yf1256673290.png") > system("convert tmp/7k1c21256673290.ps tmp/7k1c21256673290.png") > system("convert tmp/84fqd1256673290.ps tmp/84fqd1256673290.png") > > > proc.time() user system elapsed 1.613 1.166 1.978