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(-7.616430991,12.00745118,4.164302325,2.554408281,11.76805524,-8.294038413,-11.20062885,2.930148889,-6.078882579,-6.398814848,3.194666802,-19.84783575,-8.851535857,10.59050062,-0.102459624,2.830184934,-1.28464649,-6.518422706,-4.895636146,13.38385737,-9.02059465,1.757173718,6.461070814,-15.90272871,-4.080427503,10.99845576,12.19450586,8.220165991,1.882978035,-1.468037105,-3.825964578,12.41084616,-5.864373047,-0.488812668,9.348860645,-5.633021093,-3.369257618,3.880786809,14.03210708,6.762723875,2.36674587,0.067625209,-0.786063994,2.631227738,9.211888963,-6.319049726,6.381793568,-3.616930591,-13.72833351,13.06189734,10.55263284,-5.070603031,7.935896036,-9.680965668,-10.09570824,4.610396848,-6.609283102,-10.61454489,1.828406973,-12.7577298) > x <- c(-114,-114,-115,-115,-114,-114,-114,-114,-114,-114,-114,-114,-114,-114,-114,-114,-115,-116,-115,-115,-116,-115,-116,-116,-116,-116,-116,-116,-116,-115,-116,-116,-117,-116,-117,-116,-115,-114,-114,-115,-114,-113,-114,-113,-112,-113,-113,-113,-114,-115,-116,-116,-116,-117,-116,-117,-118,-119,-118,-119) > 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 -8.5394222 2 11.0844600 3 4.0678704 4 2.4579764 5 10.8450640 6 -9.2170296 7 -12.1236201 8 2.0071577 9 -7.0018738 10 -7.3218061 11 2.2716756 12 -20.7708270 13 -9.7745271 14 9.6675094 15 -1.0254508 16 1.9071937 17 -1.3810784 18 -5.7882953 19 -4.9920681 20 13.2874255 21 -8.2904673 22 1.6607418 23 7.1911982 24 -15.1726013 25 -3.3503001 26 11.7285831 27 12.9246332 28 8.9502934 29 2.6131054 30 -1.5644690 31 -3.0958372 32 13.1409735 33 -4.3076864 34 0.2413147 35 10.9055473 36 -4.9028937 37 -3.4656895 38 2.9577956 39 13.1091159 40 6.6662920 41 1.4437547 42 -1.6819253 43 -1.7090552 44 0.8816772 45 6.6357792 46 -8.0686002 47 4.6322431 48 -5.3664811 49 -14.6513247 50 12.9654654 51 11.2827602 52 -4.3404757 53 8.6660234 54 -8.1242790 55 -9.3655809 56 6.1670835 57 -4.2260371 58 -7.4047396 59 4.2116529 60 -9.5479246 > library(lattice) > postscript(file="/var/www/rcomp/tmp/16qvz1256915783.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/2335r1256915783.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/3e3fv1256915783.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/4n1101256915783.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/56brn1256915783.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/67rpd1256915784.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/7x81q1256915784.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/8eize1256915784.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. -119.0 -116.0 -115.0 -115.1 -114.0 -112.0 > > #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/9cs651256915784.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/10w5e31256915784.tab") > > system("convert tmp/16qvz1256915783.ps tmp/16qvz1256915783.png") > system("convert tmp/2335r1256915783.ps tmp/2335r1256915783.png") > system("convert tmp/3e3fv1256915783.ps tmp/3e3fv1256915783.png") > system("convert tmp/4n1101256915783.ps tmp/4n1101256915783.png") > system("convert tmp/56brn1256915783.ps tmp/56brn1256915783.png") > system("convert tmp/67rpd1256915784.ps tmp/67rpd1256915784.png") > system("convert tmp/7x81q1256915784.ps tmp/7x81q1256915784.png") > system("convert tmp/8eize1256915784.ps tmp/8eize1256915784.png") > > > proc.time() user system elapsed 1.940 1.600 3.323