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(10001.60,10411.75,10673.38,10539.51,10723.78,10682.06,10283.19,10377.18,10486.64,10545.38,10554.27,10532.54,10324.31,10695.25,10827.81,10872.48,10971.19,11145.65,11234.68,11333.88,10997.97,11036.89,11257.35,11533.59,11963.12,12185.15,12377.62,12512.89,12631.48,12268.53,12754.80,13407.75,13480.21,13673.28,13239.71,13557.69,13901.28,13200.58,13406.97,12538.12,12419.57,12193.88,12656.63,12812.48,12056.67,11322.38,11530.75,11114.08,9181.73,8614.55,8595.56,8396.20,7690.50,7235.47,7992.12,8398.37,8593.01,8679.75,9374.63,9634.97) > x <- c(49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68,70.3,75.26,71.44,76.36,81.71,92.6,90.6,92.23,94.09,102.79,109.65,124.05,132.69,135.81,116.07,101.42,75.73,55.48,43.8,45.29,44.01,47.48,51.07,57.84,69.04,65.61,72.87,68.41) > 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 -339.61344 2 231.44831 3 649.01708 4 372.70643 5 499.43183 6 190.23599 7 -204.37144 8 -58.52026 9 -73.38501 10 -103.80363 11 -313.36998 12 -328.35093 13 -372.47225 14 106.09747 15 192.47970 16 20.46941 17 183.47307 18 311.75531 19 217.13988 20 179.58265 21 -75.33865 22 -201.94819 23 21.35352 24 656.00403 25 1235.07896 26 1478.06656 27 1561.84120 28 1962.10054 29 1963.47005 30 1473.35359 31 1756.08620 32 2407.97056 33 2387.36460 34 2404.24866 35 2106.37025 36 2249.58516 37 2403.13589 38 1315.60829 39 1593.04101 40 666.29119 41 481.67147 42 -53.05436 43 166.01912 44 -189.63845 45 -1252.35300 46 -2097.46964 47 -1187.90801 48 -1084.19010 49 -2103.99638 50 -1951.86886 51 -1555.96939 52 -1808.25621 53 -2468.48887 54 -3046.77799 55 -2417.64967 56 -2251.87927 57 -2455.07849 58 -2246.50023 59 -1809.50529 60 -1390.74003 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1je9n1257524069.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/25mor1257524069.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/30yns1257524069.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/4chma1257524069.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/5gr891257524069.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/6spfs1257524069.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/7c0hf1257524069.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/85pag1257524069.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. 40.22 55.44 63.86 69.39 74.62 135.80 > > #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/9wsam1257524069.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/10ejao1257524069.tab") > > system("convert tmp/1je9n1257524069.ps tmp/1je9n1257524069.png") > system("convert tmp/25mor1257524069.ps tmp/25mor1257524069.png") > system("convert tmp/30yns1257524069.ps tmp/30yns1257524069.png") > system("convert tmp/4chma1257524069.ps tmp/4chma1257524069.png") > system("convert tmp/5gr891257524069.ps tmp/5gr891257524069.png") > system("convert tmp/6spfs1257524069.ps tmp/6spfs1257524069.png") > system("convert tmp/7c0hf1257524069.ps tmp/7c0hf1257524069.png") > system("convert tmp/85pag1257524069.ps tmp/85pag1257524069.png") > > > proc.time() user system elapsed 2.617 1.958 3.011