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.93,2.83,2.72,2.73,2.72,2.77,2.61,2.47,2.3,2.38,2.43,2.39,2.6,2.84,2.87,2.92,3.08,3.33,3.48,3.57,3.66,3.77,3.75,3.75,3.81,3.82,3.89,4.05,4.1,4.07,4.26,4.4,4.61,4.63,4.48,4.46,4.45,4.32,4.52,4.21,3.97,4.12,4.5,4.73,5.26,5.2,4.94,4.95,4.52,3.85,3.41,2.95,2.68,2.53,2.44,2.16,2.2,2.1,2.29,2.2) > x <- c(2.21,2.24,2.21,2.2,2.19,2.24,2.2,2.09,2,2.07,2.13,2.13,2.32,2.59,2.68,2.7,2.76,2.95,3.14,3.2,3.25,3.35,3.42,3.53,3.67,3.71,3.75,3.89,3.93,3.94,4.11,4.23,4.36,4.4,4.22,4.11,4.1,4.02,4.09,3.89,3.63,3.77,4,4.18,4.57,4.51,4.42,4.28,3.1,2.62,2.41,1.71,1.28,1.18,1.33,1.07,1.03,0.78,0.77,0.66) > 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.0030026001 2 -0.1199449662 3 -0.2069973999 4 -0.1893482111 5 -0.1916990223 6 -0.1799449662 7 -0.3093482111 8 -0.3652071345 9 -0.4663644355 10 -0.4399087569 11 -0.4358038896 12 -0.4758038896 13 -0.4111384765 14 -0.3776665736 15 -0.4165092726 16 -0.3818076502 17 -0.2677027829 18 -0.1630373697 19 -0.1583719566 20 -0.1142670893 21 -0.0625130332 22 -0.0290049210 23 -0.1025492425 24 -0.1866903191 25 -0.2337789620 26 -0.2543757171 27 -0.2149724722 28 -0.1620611152 29 -0.1426578703 30 -0.1803070591 31 -0.1203432684 32 -0.0721335338 33 0.0384270121 34 0.0278302570 35 0.0155156550 36 0.0796567316 37 0.0773059204 38 0.0084994307 39 0.1549551092 40 -0.0020611152 41 -0.0431822069 42 -0.0002708498 43 0.2037978082 44 0.2961124101 45 0.5277940477 46 0.5136891804 47 0.3225318794 48 0.4396205223 49 0.9122247986 50 0.6093858601 51 0.3300188245 52 0.4054620392 53 0.4643771568 54 0.3908690446 55 0.1861312129 56 0.1050101212 57 0.1756068763 58 0.2668365959 59 0.4644857847 60 0.4586268612 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1mu321257605775.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/2s9qt1257605775.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/3u4bg1257605775.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/4xbgh1257605775.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/5jp361257605775.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/6lxjx1257605775.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/7yw9o1257605775.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/8rfnu1257605775.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.660 2.198 3.120 2.959 3.955 4.570 > > #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/9cv0a1257605775.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/101pi41257605775.tab") > > system("convert tmp/1mu321257605775.ps tmp/1mu321257605775.png") > system("convert tmp/2s9qt1257605775.ps tmp/2s9qt1257605775.png") > system("convert tmp/3u4bg1257605775.ps tmp/3u4bg1257605775.png") > system("convert tmp/4xbgh1257605775.ps tmp/4xbgh1257605775.png") > system("convert tmp/5jp361257605775.ps tmp/5jp361257605775.png") > system("convert tmp/6lxjx1257605775.ps tmp/6lxjx1257605775.png") > system("convert tmp/7yw9o1257605775.ps tmp/7yw9o1257605775.png") > system("convert tmp/8rfnu1257605775.ps tmp/8rfnu1257605775.png") > > > proc.time() user system elapsed 1.614 1.179 25.674