R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(131.6,132.05,132.4,132.57,133.02,133.47,133.66,133.96,134.19,134.93,134.9,135.05,135.16,135.23,135.15,135.12,137.29,137.41,137.44,137.62,137.78,137.98,138.06,138.16,138.28,138.33,138.43,138.44,138.41,138.55,138.64,138.72,138.9,139.02,139.04,139.15,139.3,140.73,141.84,141.95,142.1,142.36,142.58,142.75,142.85,143.03,143.19,143.62,143.89,144.69,147.51,147.78,148.04,148.21,148.29,148.34,148.33,148.38,148.37,148.37) > x <- c(128.6,128.9,129.06,129.23,129.27,129.33,129.35,129.31,129.4,129.49,129.47,129.46,129.45,129.28,129.2,129.25,129.14,129.11,129.02,129.08,128.99,129.11,129.08,129.19,129.23,129.25,129.31,129.33,129.39,129.55,129.43,129.45,129.57,129.76,129.92,130.08,130.41,130.84,131.24,131.49,131.74,132.34,133.5,134.43,136.5,137.41,138.02,138.15,138.24,138.2,138.31,138.65,139.3,139.8,140.52,141.57,141.77,141.66,141.36,141.17) > 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 -4.3812468 2 -4.2313467 3 -4.0414001 4 -4.0414567 5 -3.6314700 6 -3.2414900 7 -3.0714967 8 -2.7314834 9 -2.5915134 10 -1.9415433 11 -1.9515367 12 -1.7915333 13 -1.6715300 14 -1.4314734 15 -1.4314467 16 -1.5114634 17 0.7685733 18 0.9185833 19 1.0386133 20 1.1585933 21 1.4086233 22 1.4885833 23 1.5985933 24 1.5885566 25 1.6685433 26 1.6985366 27 1.7385166 28 1.7285100 29 1.6384900 30 1.6184367 31 1.8284767 32 1.8884700 33 1.9484300 34 1.8783667 35 1.7383134 36 1.6882601 37 1.5081501 38 2.5080068 39 3.2178735 40 3.0777902 41 2.9777069 42 2.6375070 43 1.6971205 44 0.9368106 45 -1.0338792 46 -1.7641824 47 -2.2143857 48 -1.9144290 49 -1.7344590 50 -0.8944456 51 1.8155177 52 1.7454044 53 1.3551878 54 1.0250212 55 0.3847813 56 -0.6155686 57 -0.8256352 58 -0.6655986 59 -0.3754986 60 -0.1854353 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1mcok1257334747.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/freestat/rcomp/tmp/277vg1257334747.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/freestat/rcomp/tmp/3dyvb1257334747.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/freestat/rcomp/tmp/434kp1257334747.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/freestat/rcomp/tmp/591s81257334747.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/freestat/rcomp/tmp/68oue1257334747.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/freestat/rcomp/tmp/716w81257334747.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/freestat/rcomp/tmp/8t4z51257334747.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. 128.6 129.2 129.5 132.4 136.7 141.8 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/98qy71257334747.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/freestat/rcomp/tmp/10xul81257334747.tab") > > system("convert tmp/1mcok1257334747.ps tmp/1mcok1257334747.png") > system("convert tmp/277vg1257334747.ps tmp/277vg1257334747.png") > system("convert tmp/3dyvb1257334747.ps tmp/3dyvb1257334747.png") > system("convert tmp/434kp1257334747.ps tmp/434kp1257334747.png") > system("convert tmp/591s81257334747.ps tmp/591s81257334747.png") > system("convert tmp/68oue1257334747.ps tmp/68oue1257334747.png") > system("convert tmp/716w81257334747.ps tmp/716w81257334747.png") > system("convert tmp/8t4z51257334747.ps tmp/8t4z51257334747.png") > > > proc.time() user system elapsed 2.492 1.849 2.902