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(85.9,76.8,96.2,83.9,88.7,105.4,86.7,76.3,93.2,105.1,121,163,94.7,78.4,101.4,91.2,89.9,112.2,81.5,78.8,99.1,101.3,91.5,152.6,86.6,86.6,98.5,86.7,89.1,111,92.6,85.1,116.1,98.3,97.7,177.9,94.2,83.8,109.5,102.3,102.5,162.7,85.3,88.2,104.7,99.4,113.8,166.6,89.2,93.2,115,97.2,112.5,121.8,100.2,93.8,113.6,110.7,127.6,185.9) > x <- c(252.5,251.1,255.1,258.3,255.3,261.1,253.8,252.9,253.9,255.5,262,262.8,263.3,262.5,269.2,270.8,274.1,273,267.3,267.1,268.2,270.2,271.5,281,280.1,281.5,285.9,289.8,292.9,291.2,291.8,289.8,292.5,290.3,297.5,307.5,304.7,304.6,310.7,310.7,315.7,314.7,312.2,312.8,314.3,319.7,319.9,329.5,326.9,329.7,335.7,337.2,339.7,338.3,339.2,342.5,342.2,338.3,339,345.9) > 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 -5.9679504 2 -14.6482878 3 3.5526762 4 -9.7065526 5 -4.0072756 6 10.9541221 7 -5.5576371 8 -15.6878540 9 0.9123870 10 12.3327726 11 26.2843390 12 68.0445318 13 -0.4053477 14 -16.4655405 15 4.5260741 16 -6.1535403 17 -8.4427450 18 14.1869899 19 -14.8043838 20 -17.4444320 21 2.5258331 22 4.1263151 23 -6.0633716 24 52.1889178 25 -13.5412991 26 -13.9609617 27 -3.3799014 28 -16.3489615 29 -14.8782145 30 7.5313758 31 -11.0484796 32 -17.9489615 33 12.2416891 34 -4.8988410 35 -7.6571059 36 69.5453039 37 -13.3153708 38 -23.6853949 39 0.1860751 40 -7.0139249 41 -8.3127200 42 52.1870390 43 -24.4635634 44 -21.7434188 45 -5.6930573 46 -12.6117560 47 1.7282922 48 51.6506057 49 -24.9700209 50 -21.8093461 51 -1.8079002 52 -20.0575387 53 -5.5069363 54 4.2127264 55 -17.6570568 56 -25.0462615 57 -5.1563338 58 -6.8872736 59 9.8028950 60 66.0345579 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/13xfh1257330189.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/2kqwm1257330189.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/3lrjd1257330189.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/498tq1257330189.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/5mqeo1257330189.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/6j71c1257330189.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/7f4wu1257330189.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/88yqy1257330189.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. 251.1 267.2 290.8 293.8 316.7 345.9 > > #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/9098y1257330189.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/10e6s11257330189.tab") > > system("convert tmp/13xfh1257330189.ps tmp/13xfh1257330189.png") > system("convert tmp/2kqwm1257330189.ps tmp/2kqwm1257330189.png") > system("convert tmp/3lrjd1257330189.ps tmp/3lrjd1257330189.png") > system("convert tmp/498tq1257330189.ps tmp/498tq1257330189.png") > system("convert tmp/5mqeo1257330189.ps tmp/5mqeo1257330189.png") > system("convert tmp/6j71c1257330189.ps tmp/6j71c1257330189.png") > system("convert tmp/7f4wu1257330189.ps tmp/7f4wu1257330189.png") > system("convert tmp/88yqy1257330189.ps tmp/88yqy1257330189.png") > > > proc.time() user system elapsed 1.585 1.174 2.324