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(2,2.1,2.1,2.5,2.2,2.3,2.3,2.2,2.2,1.6,1.8,1.7,1.9,1.8,1.9,1.5,1,0.8,1.1,1.5,1.7,2.3,2.4,3,3,3.2,3.2,3.2,3.5,4,4.3,4.1,4,4.1,4.2,4.5,5.6,6.5,7.6,8.5,8.7,8.3,8.3,8.5,8.7,8.7,8.5,7.9,7,5.8,4.5,3.7,3.1,2.7,2.3,1.8,1.5,1.2,1) > x <- c(2.3,1.9,1.7,2.5,2.1,2.4,1.5,1.9,2.1,2.2,2,2,2.2,2.3,2.3,2,2.2,1.9,2.3,2.2,2.3,2.1,2.4,2.3,1.9,1.6,1.8,1.8,2,2.3,2.2,2.2,2,2,1.9,1.5,1.6,1.5,2,1.5,1.5,1.9,1.1,1.5,2.1,2.3,2.6,2.9,3.2,3.2,3.1,3,3.3,2.7,3.6,3.1,2.7,2.6,2.2) > 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.66607392 2 -1.90811512 3 -2.07913572 4 -0.99505332 5 -1.63709452 6 -1.28056362 7 -2.05015632 8 -1.80811512 9 -1.63709452 10 -2.15158422 11 -2.12260482 12 -2.22260482 13 -1.85158422 14 -1.86607392 15 -1.76607392 16 -2.42260482 17 -2.75158422 18 -3.20811512 19 -2.56607392 20 -2.25158422 21 -1.96607392 22 -1.53709452 23 -1.18056362 24 -0.66607392 25 -1.00811512 26 -1.06464602 27 -0.89362542 28 -0.89362542 29 -0.42260482 30 0.33392608 31 0.54841578 32 0.34841578 33 0.07739518 34 0.17739518 35 0.19188488 36 0.14984368 37 1.33535398 38 2.14984368 39 3.67739518 40 4.14984368 41 4.34984368 42 4.29188488 43 3.60780249 44 4.14984368 45 4.86290548 46 5.03392608 47 5.09045697 48 4.74698787 49 4.10351877 50 2.90351877 51 1.51800847 52 0.63249817 53 0.28902907 54 -0.62403273 55 -0.25444003 56 -1.18199153 57 -1.82403273 58 -2.20954303 59 -2.75158422 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/16das1257257047.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/2gx3s1257257047.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/3xvlb1257257047.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/4kb101257257047.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/5wm7p1257257047.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/6dz1w1257257047.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/7g5yl1257257047.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/8hh8d1257257047.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. 1.100 1.900 2.200 2.195 2.350 3.600 > > #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/9tu0v1257257047.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/10ht461257257047.tab") > > system("convert tmp/16das1257257047.ps tmp/16das1257257047.png") > system("convert tmp/2gx3s1257257047.ps tmp/2gx3s1257257047.png") > system("convert tmp/3xvlb1257257047.ps tmp/3xvlb1257257047.png") > system("convert tmp/4kb101257257047.ps tmp/4kb101257257047.png") > system("convert tmp/5wm7p1257257047.ps tmp/5wm7p1257257047.png") > system("convert tmp/6dz1w1257257047.ps tmp/6dz1w1257257047.png") > system("convert tmp/7g5yl1257257047.ps tmp/7g5yl1257257047.png") > system("convert tmp/8hh8d1257257047.ps tmp/8hh8d1257257047.png") > > > proc.time() user system elapsed 1.571 1.156 2.819