R version 2.8.1 (2008-12-22) 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(2.11,2.09,2.05,2.08,2.06,2.06,2.08,2.07,2.06,2.07,2.06,2.09,2.07,2.09,2.28,2.33,2.35,2.52,2.63,2.58,2.7,2.81,2.97,3.04,3.28,3.33,3.5,3.56,3.57,3.69,3.82,3.79,3.96,4.06,4.05,4.03,3.94,4.02,3.88,4.02,4.03,4.09,3.99,4.01,4.01,4.19,4.3,4.27,3.82,3.15,2.49,1.81,1.26,1.06,0.84,0.78,0.7,0.36,0.35,0.36) > x <- c(181.10,191.20,206.20,212.00,224.70,231.30,229.30,227.40,253.90,265.90,277.70,292.10,282.90,292.80,311.00,330.90,350.00,348.50,360.90,345.90,308.80,320.00,322.00,322.90,343.30,354.70,376.60,383.20,392.50,388.20,407.40,412.50,419.80,418.10,389.20,391.60,412.90,385.90,385.50,350.20,336.30,318.50,345.40,377.40,359.50,315.60,307.80,277.40,186.90,160.00,149.10,148.90,137.90,134.00,157.50,175.10,181.00,182.20,207.80,219.40) > 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 0.455924015 2 0.336054819 3 0.147734230 4 0.120383603 5 -0.025194495 6 -0.090455554 7 -0.050679476 8 -0.041892201 9 -0.313925241 10 -0.422581711 11 -0.549260574 12 -0.661648339 13 -0.590678378 14 -0.668569966 15 -0.658532280 16 -0.805304261 17 -0.974165810 18 -0.789333751 19 -0.801945437 20 -0.703624849 21 -0.216778594 22 -0.217524633 23 -0.077300712 24 -0.016199947 25 0.022084053 26 -0.040639594 27 -0.087187653 28 -0.092448712 29 -0.174407477 30 -0.011888908 31 -0.071739261 32 -0.152168261 33 -0.054350948 34 0.062458719 35 0.338223052 36 0.294491758 37 -0.006123477 38 0.340853582 39 0.204808798 40 0.693856582 41 0.841300327 42 1.077307426 43 0.711319170 44 0.414901915 45 0.591897817 46 1.205982739 47 1.393109445 48 1.663705838 49 2.108573387 50 1.704561643 51 1.152341270 52 0.474318878 53 0.033087309 54 -0.128349338 55 -0.580718259 56 -0.814747750 57 -0.953087181 58 -1.304952828 59 -1.568086632 60 -1.672787887 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1n8c51257618156.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/rcomp/tmp/2q50i1257618156.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/rcomp/tmp/3lwek1257618156.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/rcomp/tmp/4lev11257618156.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/rcomp/tmp/5d2jb1257618156.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/rcomp/tmp/6mv1b1257618156.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/rcomp/tmp/7mbj21257618156.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/rcomp/tmp/8xp4s1257618156.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. 134.0 217.6 313.3 293.0 359.8 419.8 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/93b1p1257618156.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/rcomp/tmp/10lzb91257618156.tab") > > system("convert tmp/1n8c51257618156.ps tmp/1n8c51257618156.png") > system("convert tmp/2q50i1257618156.ps tmp/2q50i1257618156.png") > system("convert tmp/3lwek1257618156.ps tmp/3lwek1257618156.png") > system("convert tmp/4lev11257618156.ps tmp/4lev11257618156.png") > system("convert tmp/5d2jb1257618156.ps tmp/5d2jb1257618156.png") > system("convert tmp/6mv1b1257618156.ps tmp/6mv1b1257618156.png") > system("convert tmp/7mbj21257618156.ps tmp/7mbj21257618156.png") > system("convert tmp/8xp4s1257618156.ps tmp/8xp4s1257618156.png") > > > proc.time() user system elapsed 2.010 1.710 2.879