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(4,3.8,4.7,4.3,3.9,4,4.3,4.8,4.4,4.3,4.7,4.7,4.9,5,4.2,4.3,4.8,4.8,4.8,4.2,4.6,4.8,4.5,4.4,4.3,3.9,3.7,4,4.1,3.7,3.8,3.8,3.8,3.3,3.3,3.3,3.2,3.4,4.2,4.9,5.1,5.5,5.6,6.4,6.1,7.1,7.8,7.9,7.4,7.5,6.8,5.2,4.7,4.1,3.9,2.6,2.7,1.8,1,0.3) > x <- c(2.2300144,2.163323026,2.104134154,2.116255515,2.140066163,2.151762203,2.140066163,2.104134154,2.091864062,2.066862759,2.151762203,2.163323026,2.163323026,2.140066163,2.128231706,2.140066163,2.163323026,2.163323026,2.151762203,2.140066163,2.116255515,2.079441542,2.104134154,2.091864062,2.091864062,2.079441542,2.066862759,2.066862759,2.079441542,2.079441542,2.066862759,2.079441542,2.041220329,1.974081026,2.014903021,1.987874348,1.945910149,1.945910149,1.945910149,1.974081026,1.987874348,1.960094784,1.916922612,1.85629799,1.808288771,1.871802177,2.041220329,2.066862759,2.014903021,1.931521412,1.887069649,1.931521412,2.041220329,2.079441542,2.079441542,2.041220329,1.987874348,2.00148,2.091864062,2.116255515) > 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.389436336 2 -0.134794314 3 0.477449635 4 0.136379546 5 -0.147861227 6 0.009000919 7 0.252138773 8 0.577449635 9 0.117796645 10 -0.103751139 11 0.709000919 12 0.765205686 13 0.965205686 14 0.952138773 15 0.094603691 16 0.252138773 17 0.865205686 18 0.865205686 19 0.809000919 20 0.152138773 21 0.436379546 22 0.457402601 23 0.277449635 24 0.117796645 25 0.017796645 26 -0.442597399 27 -0.703751139 28 -0.403751139 29 -0.242597399 30 -0.642597399 31 -0.603751139 32 -0.542597399 33 -0.728415863 34 -1.554824191 35 -1.356361614 36 -1.487765777 37 -1.791781359 38 -1.591781359 39 -0.791781359 40 0.045175809 41 0.312234223 42 0.577179484 43 0.467291150 44 0.972554974 45 0.439150572 46 1.747931028 47 3.271584137 48 3.496248861 49 2.743638386 50 2.438265523 51 1.522156255 52 0.138265523 53 0.171584137 54 -0.242597399 55 -0.442597399 56 -1.928415863 57 -2.087765777 58 -2.921619751 59 -3.282203355 60 -3.863620454 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1suzl1256811978.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/2jr1w1256811978.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/3upkc1256811978.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/470pj1256811978.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/56vmr1256811978.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/6acgx1256811978.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/7zfdi1256811978.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/8kvt01256811978.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.808 1.988 2.079 2.056 2.119 2.230 > > #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/91tm41256811978.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/10mlks1256811979.tab") > > system("convert tmp/1suzl1256811978.ps tmp/1suzl1256811978.png") > system("convert tmp/2jr1w1256811978.ps tmp/2jr1w1256811978.png") > system("convert tmp/3upkc1256811978.ps tmp/3upkc1256811978.png") > system("convert tmp/470pj1256811978.ps tmp/470pj1256811978.png") > system("convert tmp/56vmr1256811978.ps tmp/56vmr1256811978.png") > system("convert tmp/6acgx1256811978.ps tmp/6acgx1256811978.png") > system("convert tmp/7zfdi1256811978.ps tmp/7zfdi1256811978.png") > system("convert tmp/8kvt01256811978.ps tmp/8kvt01256811978.png") > > > proc.time() user system elapsed 1.558 1.120 2.064