R version 2.8.1 (2008-12-22) 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(2.86,2.55,2.27,2.26,2.57,3.07,2.76,2.51,2.87,3.14,3.11,3.16,2.47,2.57,2.89,2.63,2.38,1.69,1.96,2.19,1.87,1.60,1.63,1.22,1.21,1.49,1.64,1.66,1.77,1.82,1.78,1.28,1.29,1.37,1.12,1.51,2.24,2.94,3.09,3.46,3.64,4.39,4.15,5.21,5.80,5.91,5.39,5.46,4.72,3.14,2.63,2.32,1.93,0.62,0.60,-0.37,-1.10,-1.68,-0.78) > x <- c(0.5857,0.5858,0.5717,0.5945,0.5961,0.5973,0.6036,0.6096,0.6315,0.6262,0.6121,0.6326,0.6214,0.6274,0.6175,0.6208,0.6225,0.5889,0.6020,0.5932,0.5841,0.6000,0.5947,0.5891,0.6051,0.5960,0.6012,0.5957,0.5959,0.6049,0.6064,0.6137,0.6311,0.6258,0.6010,0.6232,0.6384,0.6014,0.5980,0.5987,0.6237,0.5813,0.5991,0.6160,0.6096,0.6051,0.5857,0.5565,0.5223,0.5091,0.4919,0.4995,0.5069,0.5190,0.5460,0.5648,0.5751,0.5862,0.5877) > par2 = '1' > 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.50821855 2 0.19791777 3 -0.03967311 4 -0.11824955 5 0.18693806 6 0.68332878 7 0.35438002 8 0.08633359 9 0.38046411 10 0.66640513 11 0.67881425 12 0.66715560 13 0.01084228 14 0.09279584 15 0.44257246 16 0.17264692 17 -0.08246624 18 -0.67140622 19 -0.44080759 20 -0.18433949 21 -0.47696907 22 -0.79479212 23 -0.74885110 24 -1.14200776 25 -1.20013158 26 -0.89276116 27 -0.75840140 28 -0.72185884 29 -0.61246039 30 -0.58953004 31 -0.63404164 32 -1.15599814 33 -1.19833279 34 -1.10239178 35 -1.27779986 36 -0.95457165 37 -0.27028928 38 0.54099705 39 0.70122336 40 1.06911794 41 1.17392448 42 2.05145260 43 1.75791485 44 2.76708406 45 3.37633359 46 3.49986842 47 3.03821855 48 3.19604452 49 2.55890918 50 1.01861133 51 0.56034444 52 0.22748562 53 -0.18477164 54 -1.53116528 55 -1.63237423 56 -2.65891971 57 -3.41989942 58 -4.03328532 59 -3.13779693 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1hmki1256495213.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/rcomp/tmp/2w3ms1256495213.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/rcomp/tmp/302rn1256495213.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/rcomp/tmp/4th4k1256495213.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/rcomp/tmp/5hj5l1256495213.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/rcomp/tmp/6ougk1256495213.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/rcomp/tmp/7rpvc1256495213.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/rcomp/tmp/8dav01256495213.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. 0.4919 0.5858 0.5987 0.5920 0.6129 0.6384 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9s6xs1256495213.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/rcomp/tmp/10bx7s1256495213.tab") > > system("convert tmp/1hmki1256495213.ps tmp/1hmki1256495213.png") > system("convert tmp/2w3ms1256495213.ps tmp/2w3ms1256495213.png") > system("convert tmp/302rn1256495213.ps tmp/302rn1256495213.png") > system("convert tmp/4th4k1256495213.ps tmp/4th4k1256495213.png") > system("convert tmp/5hj5l1256495213.ps tmp/5hj5l1256495213.png") > system("convert tmp/6ougk1256495213.ps tmp/6ougk1256495213.png") > system("convert tmp/7rpvc1256495213.ps tmp/7rpvc1256495213.png") > system("convert tmp/8dav01256495213.ps tmp/8dav01256495213.png") > > > proc.time() user system elapsed 1.770 1.660 3.163