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(131.05,119.47,120.22,119.13,121.16,122.81,124.21,122.43,119.33,121.97,118.96,116.33,114.74,112.22,111.88,113.99,117.8,116.74,113.09,112.94,113.04,116.46,121.33,115.99,116.58,117.98,121.54,127.45,116.88,109.81,110.96,110.41,114.9,115.3,116.4,116.93,115.83,115.72,114.63,119.4,125.1,129.73,127.31,129.43,137.73,139.95,146.16,142.18,140.21,133.9,137.49,145.88,153.86,151.88,160.5,166.51,166.23,169.35,170.33,162.31,156.53) > x <- c(124,118.63,121.86,119.97,125.03,130.09,126.65,121.7,119.24,122.63,116.66,114.12,113.11,112.61,113.4,115.18,121.01,119.44,116.68,117.07,117.41,119.58,120.92,117.09,116.77,119.39,122.49,124.08,118.29,112.94,113.79,114.43,118.7,120.36,118.27,118.34,117.82,117.65,118.18,121.02,124.78,131.16,130.14,131.75,134.73,135.35,140.32,136.35,131.6,128.9,133.89,138.25,146.23,144.76,149.3,156.8,159.08,165.12,163.14,153.43,151.01) > 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 6.96107043 2 2.02723943 3 -1.22036316 4 0.02879130 5 -4.20370687 6 -8.81620504 7 -3.15869640 8 1.18766050 9 1.13227423 10 -0.42335201 11 3.95540571 12 4.46903127 13 4.12905561 14 2.22787954 15 0.91013773 16 0.81712454 17 -2.58836248 18 -1.70525534 19 -1.93934725 20 -2.57202991 21 -2.89283018 22 -2.15852604 23 1.05302583 24 0.45321713 25 1.43926445 26 -0.40337294 27 -0.68008131 28 3.26205860 29 -0.14196030 30 -0.59054425 31 -0.49254493 32 -1.83463956 33 -2.62939592 34 -4.28389137 35 -0.59720734 36 -0.15384269 37 -0.61026581 38 -0.50986567 39 -2.25581903 40 -1.00073895 41 0.04570510 42 -3.22048825 43 -4.37808743 44 -4.25070048 45 0.36110890 46 1.81376722 47 1.87265736 48 2.80611937 49 6.71494670 50 3.74659592 51 1.16073310 52 4.15458843 53 2.25815852 54 2.09750087 55 5.09857959 56 1.82622065 57 -1.27561647 58 -5.63100954 59 -2.20046678 60 1.79709393 61 -0.98779825 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1z6f11257349331.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/2rupl1257349331.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/3n17c1257349331.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/4v3jh1257349331.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/5db661257349331.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/6x2ub1257349331.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/7xfzd1257349331.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/82lav1257349331.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. 112.6 117.8 121.0 126.9 131.8 165.1 > > #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/9w3rb1257349331.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/10gtjc1257349331.tab") > > system("convert tmp/1z6f11257349331.ps tmp/1z6f11257349331.png") > system("convert tmp/2rupl1257349331.ps tmp/2rupl1257349331.png") > system("convert tmp/3n17c1257349331.ps tmp/3n17c1257349331.png") > system("convert tmp/4v3jh1257349331.ps tmp/4v3jh1257349331.png") > system("convert tmp/5db661257349331.ps tmp/5db661257349331.png") > system("convert tmp/6x2ub1257349331.ps tmp/6x2ub1257349331.png") > system("convert tmp/7xfzd1257349331.ps tmp/7xfzd1257349331.png") > system("convert tmp/82lav1257349331.ps tmp/82lav1257349331.png") > > > proc.time() user system elapsed 1.627 1.169 2.177