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(1.9,1.6,1.7,2,2.5,2.4,2.3,2.3,2.1,2.4,2.2,2.4,1.9,2.1,2.1,2.1,2,2.1,2.2,2.2,2.6,2.5,2.3,2.2,2.4,2.3,2.2,2.5,2.5,2.5,2.4,2.3,1.7,1.6,1.9,1.9,1.8,1.8,1.9,1.9,1.9,1.9,1.8,1.7,2.1,2.6,3.1,3.1,3.2,3.3,3.6,3.3,3.7,4,4,3.8,3.6,3.2,2.1,1.6) > x <- c(8.9,9,9,9,9,9,9,9,9,9,9,9.1,9,9,9.1,9,9,9,9,8.9,8.9,8.9,8.9,8.8,8.8,8.7,8.7,8.5,8.5,8.4,8.2,8.2,8.1,8.1,8,7.9,7.8,7.7,7.6,7.5,7.5,7.5,7.5,7.5,7.4,7.4,7.3,7.3,7.3,7.2,7.2,7.3,7.4,7.4,7.5,7.6,7.7,7.9,8,8.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 -0.2394125147 2 -0.4997964693 3 -0.3997964693 4 -0.0997964693 5 0.4002035307 6 0.3002035307 7 0.2002035307 8 0.2002035307 9 0.0002035307 10 0.3002035307 11 0.1002035307 12 0.3398195761 13 -0.1997964693 14 0.0002035307 15 0.0398195761 16 0.0002035307 17 -0.0997964693 18 0.0002035307 19 0.1002035307 20 0.0605874853 21 0.4605874853 22 0.3605874853 23 0.1605874853 24 0.0209714399 25 0.2209714399 26 0.0813553945 27 -0.0186446055 28 0.2021233037 29 0.2021233037 30 0.1625072583 31 -0.0167248325 32 -0.1167248325 33 -0.7563408779 34 -0.8563408779 35 -0.5959569233 36 -0.6355729687 37 -0.7751890141 38 -0.8148050595 39 -0.7544211049 40 -0.7940371503 41 -0.7940371503 42 -0.7940371503 43 -0.8940371503 44 -0.9940371503 45 -0.6336531957 46 -0.1336531957 47 0.3267307589 48 0.3267307589 49 0.4267307589 50 0.4871147135 51 0.7871147135 52 0.5267307589 53 0.9663468043 54 1.2663468043 55 1.3059628497 56 1.1455788951 57 0.9851949405 58 0.6644270313 59 -0.3959569233 60 -0.8167248325 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/17swc1256755869.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/2t9y21256755869.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/3fn5e1256755869.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/425wf1256755869.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/576y41256755869.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/6xuev1256755869.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/7c5kr1256755869.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/8fm171256755869.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. 7.200 7.500 8.300 8.272 9.000 9.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/9gjvh1256755869.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/10awdu1256755869.tab") > > system("convert tmp/17swc1256755869.ps tmp/17swc1256755869.png") > system("convert tmp/2t9y21256755869.ps tmp/2t9y21256755869.png") > system("convert tmp/3fn5e1256755869.ps tmp/3fn5e1256755869.png") > system("convert tmp/425wf1256755869.ps tmp/425wf1256755869.png") > system("convert tmp/576y41256755869.ps tmp/576y41256755869.png") > system("convert tmp/6xuev1256755869.ps tmp/6xuev1256755869.png") > system("convert tmp/7c5kr1256755869.ps tmp/7c5kr1256755869.png") > system("convert tmp/8fm171256755869.ps tmp/8fm171256755869.png") > > > proc.time() user system elapsed 1.542 1.117 2.526