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(64,65.61,59.29,56.25,57.76,60.84,60.84,60.84,56.25,56.25,50.41,56.25,56.25,57.76,59.29,59.29,62.41,65.61,67.24,67.24,67.24,62.41,53.29,47.61,43.56,44.89,47.61,49,50.41,51.84,50.41,47.61,49,46.24,40.96,44.89,43.56,40.96,39.69,38.44,42.25,46.24,46.24,40.96,37.21,33.64,37.21,51.84,53.29,47.61,37.21,33.64,38.44,50.41,59.29,62.41,59.29,54.76,56.25,64) > x <- c(11.1,10.9,10,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9,9,9,9.8,10,9.8,9.3,9,9,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.7,7.9,7.9,8,7.9,7.6,7.1,6.8,6.5,6.9,8.2,8.7,8.3,7.9,7.5,7.8,8.3,8.4,8.2,7.7,7.2,7.3,8.1) > 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 -1.034553124 2 1.693669206 3 0.405669692 4 1.838559013 5 3.348559013 6 4.751225517 7 4.192114352 8 4.751225517 9 2.397670178 10 3.515892508 11 -2.883218657 12 -3.193441473 13 -4.311663804 14 -2.242552638 15 2.642114352 16 4.878559013 17 7.439447848 18 10.080336682 19 11.710336682 20 12.828559013 21 13.946781343 22 9.116781343 23 -0.003218657 24 -10.156107978 25 -15.324330308 26 -12.876107978 27 -7.360552152 28 -4.293218657 29 -2.883218657 30 -2.012329822 31 -3.442329822 32 -6.242329822 33 -5.411440987 34 -5.934996327 35 -8.419440501 36 -5.048551666 37 -4.701218171 38 -5.064773511 39 -7.452995841 40 -8.702995841 41 -5.452107006 42 -0.902995841 43 0.774337654 44 -1.710106520 45 -3.782773025 46 -5.675439529 47 -4.341884190 48 3.019670664 49 1.674114838 50 -1.769440501 51 -9.932995841 52 -11.266551180 53 -8.143884676 54 1.030559499 55 9.351448334 56 13.589670664 57 13.265226489 58 11.530782315 59 12.461671150 60 15.738781829 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1zxlw1256652631.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/2w16s1256652631.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/3wliw1256652631.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/4bywh1256652631.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/50whe1256652631.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/6r5r91256652631.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/7zhrr1256652631.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/8jz4h1256652631.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. 6.500 7.975 9.000 8.743 9.325 11.100 > > #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/927yw1256652631.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/1068ij1256652631.tab") > > system("convert tmp/1zxlw1256652631.ps tmp/1zxlw1256652631.png") > system("convert tmp/2w16s1256652631.ps tmp/2w16s1256652631.png") > system("convert tmp/3wliw1256652631.ps tmp/3wliw1256652631.png") > system("convert tmp/4bywh1256652631.ps tmp/4bywh1256652631.png") > system("convert tmp/50whe1256652631.ps tmp/50whe1256652631.png") > system("convert tmp/6r5r91256652631.ps tmp/6r5r91256652631.png") > system("convert tmp/7zhrr1256652631.ps tmp/7zhrr1256652631.png") > system("convert tmp/8jz4h1256652631.ps tmp/8jz4h1256652631.png") > > > proc.time() user system elapsed 1.583 1.178 2.420