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(9.9,9.8,9.3,8.3,8,8.5,10.4,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) > x <- c(17.25,16.64,15.11,13.04,12.17,12.45,15.41,16.64,16.94,15.72,15.11,15.41,16.02,16.02,16.02,15.11,15.11,13.92,15.11,15.11,15.41,15.72,15.72,16.33,16.94,17.25,17.25,17.25,16.33,14.51,13.33,12.45,12.74,13.33,13.62,13.92,14.21,13.92,13.33,13.62,13.04,11.88,12.74,12.45,11.88,11.60,11.31,12.17,13.04,13.04,11.88,11.03,10.20,11.03,14.21,14.51,13.33,11.03,10.20,11.31) > 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.219611453 2 -0.085400843 3 0.002045441 4 -0.203174293 5 -0.169136210 6 0.223357281 7 0.986859895 8 1.214599157 9 0.899413611 10 0.467834831 11 -0.097954559 12 -0.213140105 13 -0.147350715 14 -0.047350715 15 -0.147350715 16 -0.197954559 17 -0.397954559 18 0.158948106 19 0.802045441 20 1.002045441 21 0.786859895 22 0.067834831 23 -0.332165169 24 -0.466375779 25 -0.600586389 26 -0.719611453 27 -0.919611453 28 -1.119611453 29 -0.766375779 30 -0.067583467 31 1.185479680 32 1.723357281 33 1.412011253 34 0.685479680 35 0.274133652 36 0.158948106 37 0.147602078 38 0.258948106 39 0.485479680 40 0.474133652 41 0.296825707 42 0.242209818 43 0.012011253 44 -0.176642719 45 -0.357790182 46 -0.050283673 47 0.061062355 48 -0.169136210 49 -0.603174293 50 -0.903174293 51 -0.957790182 52 -0.931431136 53 -0.912751125 54 -0.831431136 55 -0.752397922 56 -0.367583467 57 -0.314520320 58 0.168568864 59 0.087248875 60 -0.038937645 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1l6wg1256744971.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/2eh811256744971.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/3swp21256744971.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/4f3kw1256744971.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/5odkn1256744971.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/6hhr21256744971.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/7cy2r1256744971.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/8lzyj1256744971.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. 10.20 12.45 13.92 14.06 15.72 17.25 > > #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/9jg471256744971.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/1026jo1256744972.tab") > > system("convert tmp/1l6wg1256744971.ps tmp/1l6wg1256744971.png") > system("convert tmp/2eh811256744971.ps tmp/2eh811256744971.png") > system("convert tmp/3swp21256744971.ps tmp/3swp21256744971.png") > system("convert tmp/4f3kw1256744971.ps tmp/4f3kw1256744971.png") > system("convert tmp/5odkn1256744971.ps tmp/5odkn1256744971.png") > system("convert tmp/6hhr21256744971.ps tmp/6hhr21256744971.png") > system("convert tmp/7cy2r1256744971.ps tmp/7cy2r1256744971.png") > system("convert tmp/8lzyj1256744971.ps tmp/8lzyj1256744971.png") > > > proc.time() user system elapsed 2.592 1.921 2.930