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(1080.85,1077.06,1005.58,930.68,909.52,875.57,857.2,822.25,782.3,747.35,755.14,1015.58,1069.9,1068.9,995,921.1,893.15,848.62,834.04,789.3,765.93,747.56,753.35,985.63,1026.37,1014.58,894.73,810.04,761.51,770.3,723.56,671.82,648.45,592.92,569.34,804.83,848.57,791.83,724.72,655.61,653.82,656.82,623.66,574.92,560.34,487.23,512.6,732.51,759.67,727.3,668.98,641.82,667.4,690.98,695.98,693.19,688.4,628.08,664.24,877.36,921.1) > x <- c(635.85,628.86,548.28,479.98,452.42,418.57,398.5,365.05,330.7,296.65,303.84,548.28,602.8,602.9,534.2,466.4,432.95,385.42,371.84,330.5,310.53,290.36,296.85,514.03,554.67,547.48,445.43,371.04,323.61,330,289.36,248.62,228.25,180.22,166.64,377.13,417.77,377.23,316.92,256.51,249.92,250.32,223.26,183.32,169.44,109.33,130.4,327.41,354.07,333.8,278.78,250.02,263.1,276.08,275.88,267.79,261.1,205.88,232.24,421.66,463.4) > 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 -32.911682 2 -28.624007 3 -6.985403 4 -2.957622 5 7.730835 6 12.898045 7 17.721025 8 21.425993 9 21.171004 10 25.569334 11 25.050539 12 3.014597 13 -5.668956 14 -6.784516 15 -1.294493 16 3.155486 17 13.860453 18 24.256331 19 25.369439 20 28.402125 21 28.109545 22 33.048086 23 31.338213 24 12.644048 25 6.420284 26 2.939080 27 1.018510 28 2.293922 29 8.574239 30 9.979927 31 10.203690 32 5.543014 33 5.712676 34 5.686356 35 -2.200536 36 -9.953709 37 -13.177472 38 -23.069269 39 -20.484767 40 -19.784705 41 -13.959272 42 -11.421513 43 -13.310858 44 -15.896018 45 -14.436229 46 -18.082848 47 -17.061432 48 -24.817057 49 -28.465471 50 -37.411369 51 -32.150015 52 -26.074832 53 -15.610138 54 -7.029883 55 -1.798762 56 4.760078 57 7.701071 58 11.193547 59 16.891814 60 11.117227 61 6.622299 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1oumt1257076289.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/2o46p1257076289.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/37lh11257076289.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/4sbs61257076289.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/50gxq1257076289.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/67umg1257076289.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/7uec31257076289.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/8ytpb1257076289.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. 109.3 261.1 330.0 352.5 433.0 635.8 > > #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/91ker1257076289.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/10yfbx1257076289.tab") > > system("convert tmp/1oumt1257076289.ps tmp/1oumt1257076289.png") > system("convert tmp/2o46p1257076289.ps tmp/2o46p1257076289.png") > system("convert tmp/37lh11257076289.ps tmp/37lh11257076289.png") > system("convert tmp/4sbs61257076289.ps tmp/4sbs61257076289.png") > system("convert tmp/50gxq1257076289.ps tmp/50gxq1257076289.png") > system("convert tmp/67umg1257076289.ps tmp/67umg1257076289.png") > system("convert tmp/7uec31257076289.ps tmp/7uec31257076289.png") > system("convert tmp/8ytpb1257076289.ps tmp/8ytpb1257076289.png") > > > proc.time() user system elapsed 1.611 1.190 2.142