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(73.005,71.145,58.725,48.79,49.385,53.125,54.61,53.125,47.97,45.765,45.425,58.91,61.335,60.465,53.975,49.98,51.425,53.505,53.505,51.17,48.875,47.725,46,53.71,54.675,53.055,48.4,45.425,45.425,46.8,46.8,46.215,47.6,42.735,36.36,38.625,35.405,31.15,32.55,32.55,34.2,33.945,30.885,26.18,22.72,19.825,23.725,38.115,43.055,37.875,32.085,28.05,31.395,38.885,41.2,39.6,34.265,28.835,29.97,39.285,43.575) > x <- c(44.175,45.105,38.715,34.85,36.105,38.675,39.13,38.675,34.85,34.425,30.415,36.55,36.975,37.845,37.825,37.38,39.525,42.195,43.065,42.57,42.075,38.595,32.4,29.93,27.135,27.945,29.2,29.625,30.415,31.6,30.8,28.835,30,27.335,22.68,25.875,24.455,22.05,21.35,20.65,23.4,25.915,25.205,21.42,18.24,15.555,18.525,30.415,31.995,27.375,19.665,16.83,20.355,29.645,35.6,37.2,34.265,30.295,31.45,38.475,40.255) > 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 13.85749431 2 10.88364616 3 6.11686088 4 0.81091798 5 -0.09717818 6 0.56476832 7 1.50482111 8 0.56476832 9 -0.00908202 10 -1.70506539 11 2.75765621 12 8.89485147 13 10.81083484 14 8.89884786 15 2.43280158 16 -1.02922807 17 -2.15326493 18 -3.27108704 19 -4.31307402 20 -6.05521936 21 -7.75736470 22 -4.73941678 23 0.95524913 24 11.62353401 25 15.93606689 26 13.34594108 27 7.18784492 28 3.70382829 29 2.75765621 30 2.71339808 31 3.67154703 32 5.44000038 33 5.42969597 34 3.75652965 35 2.95675884 36 1.39515148 37 -0.12413413 38 -1.49869886 39 0.73968147 40 1.57806180 41 -0.06557521 42 -3.33275596 43 -5.54239877 44 -5.71415657 45 -5.36551450 46 -5.04472709 47 -4.70185506 48 -4.55234379 49 -1.50468796 50 -1.15137779 51 2.29278269 52 1.65322302 53 0.77637922 54 -2.86012543 55 -7.67734666 56 -11.19364455 57 -13.01343560 58 -13.68862145 59 -13.93694899 60 -13.03569444 61 -10.87757585 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1vxs91257273317.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/2cmsu1257273317.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/3b4iz1257273317.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/4ue4n1257273317.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/5g7e91257273317.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/6fczx1257273317.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/742c81257273317.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/8tit71257273317.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. 15.56 25.92 30.80 31.38 37.83 45.10 > > #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/94u0f1257273317.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/104v561257273317.tab") > > system("convert tmp/1vxs91257273317.ps tmp/1vxs91257273317.png") > system("convert tmp/2cmsu1257273317.ps tmp/2cmsu1257273317.png") > system("convert tmp/3b4iz1257273317.ps tmp/3b4iz1257273317.png") > system("convert tmp/4ue4n1257273317.ps tmp/4ue4n1257273317.png") > system("convert tmp/5g7e91257273317.ps tmp/5g7e91257273317.png") > system("convert tmp/6fczx1257273317.ps tmp/6fczx1257273317.png") > system("convert tmp/742c81257273317.ps tmp/742c81257273317.png") > system("convert tmp/8tit71257273317.ps tmp/8tit71257273317.png") > > > proc.time() user system elapsed 1.589 1.152 2.039