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(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,8.5) > x <- c(8.1,8,7.5,7.4,7.7,7.9,7.7,7.1,6.2,5.8,6.1,6.9,7.3,7.2,6.1,5.8,6.1,6.3,6.8,6.8,6.5,6.2,6.3,6.4,6.6,7.6,6.4,6.8,7,6.9,7.1,7.2,7.1,7,6.9,6.7,6.6,6.9,7.3,7.9,8.2,8.2,8.2,8.1,7.9,7.7,7.7,7.6,7.5,7.5,7.1,7.5,7.5,7.8,7.8,7.8,7.6,7.5,7.7,8.1,8) > 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 2.80113193 2 2.55219013 3 1.40748113 4 0.55853934 5 0.70536473 6 1.10324833 7 1.10536473 8 0.71171394 9 -0.12876225 10 -0.52452945 11 -0.27770405 12 1.21383034 13 1.60959754 14 1.46065574 15 0.32229595 16 -0.22452945 17 0.02229595 18 0.22017955 19 0.46488854 20 0.26488854 21 -0.08193685 22 -0.22876225 23 -0.17982045 24 0.66912135 25 0.96700494 26 1.25642293 27 0.16912135 28 0.06488854 29 0.16277214 30 0.21383034 31 0.31171394 32 0.36065574 33 0.41171394 34 -0.03722786 35 -0.58616966 36 -0.58405326 37 -0.93299506 38 -1.18616966 39 -0.79040246 40 -0.49675167 41 -0.24992627 42 -0.34992627 43 -0.64992627 44 -1.19886807 45 -1.59675167 46 -1.99463527 47 -1.59463527 48 -0.34357707 49 0.10748113 50 -0.29251887 51 -0.88828606 52 -1.09251887 53 -0.79251887 54 -0.14569347 55 -0.04569347 56 -0.24569347 57 -0.84357707 58 -1.39251887 59 -1.19463527 60 -0.19886807 61 0.15219013 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1sv7i1256902638.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/2ynsl1256902638.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/32vit1256902638.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/4f2wk1256902638.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/5f3n51256902638.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/68zbu1256902638.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/79qmj1256902638.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/8s5zz1256902638.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. 5.8 6.8 7.3 7.2 7.7 8.2 > > #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/9iid41256902638.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/10s8171256902638.tab") > > system("convert tmp/1sv7i1256902638.ps tmp/1sv7i1256902638.png") > system("convert tmp/2ynsl1256902638.ps tmp/2ynsl1256902638.png") > system("convert tmp/32vit1256902638.ps tmp/32vit1256902638.png") > system("convert tmp/4f2wk1256902638.ps tmp/4f2wk1256902638.png") > system("convert tmp/5f3n51256902638.ps tmp/5f3n51256902638.png") > system("convert tmp/68zbu1256902638.ps tmp/68zbu1256902638.png") > system("convert tmp/79qmj1256902638.ps tmp/79qmj1256902638.png") > system("convert tmp/8s5zz1256902638.ps tmp/8s5zz1256902638.png") > > > proc.time() user system elapsed 2.533 1.880 2.926