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(9487,8700,9627,8947,9283,8829,9947,9628,9318,9605,8640,9214,9567,8547,9185,9470,9123,9278,10170,9434,9655,9429,8739,9552,9687,9019,9672,9206,9069,9788,10312,10105,9863,9656,9295,9946,9701,9049,10190,9706,9765,9893,9994,10433,10073,10112,9266,9820,10097,9115,10411,9678,10408,10153,10368,10581,10597,10680,9738,9556) > x <- c(3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333,3557.683333) > 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 -152.6 2 -939.6 3 -12.6 4 -692.6 5 -356.6 6 -810.6 7 307.4 8 -11.6 9 -321.6 10 -34.6 11 -999.6 12 -425.6 13 -72.6 14 -1092.6 15 -454.6 16 -169.6 17 -516.6 18 -361.6 19 530.4 20 -205.6 21 15.4 22 -210.6 23 -900.6 24 -87.6 25 47.4 26 -620.6 27 32.4 28 -433.6 29 -570.6 30 148.4 31 672.4 32 465.4 33 223.4 34 16.4 35 -344.6 36 306.4 37 61.4 38 -590.6 39 550.4 40 66.4 41 125.4 42 253.4 43 354.4 44 793.4 45 433.4 46 472.4 47 -373.6 48 180.4 49 457.4 50 -524.6 51 771.4 52 38.4 53 768.4 54 513.4 55 728.4 56 941.4 57 957.4 58 1040.4 59 98.4 60 -83.6 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1vry01256672834.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/2vl8e1256672834.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/3cc7w1256672834.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/4oacv1256672834.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/53yrc1256672834.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/6sd7l1256672834.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/7ylic1256672834.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/8m65n1256672834.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. 3558 3558 3558 3558 3558 3558 > > #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/9wtzl1256672834.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/10w5gc1256672834.tab") > > system("convert tmp/1vry01256672834.ps tmp/1vry01256672834.png") > system("convert tmp/2vl8e1256672834.ps tmp/2vl8e1256672834.png") > system("convert tmp/3cc7w1256672834.ps tmp/3cc7w1256672834.png") > system("convert tmp/4oacv1256672834.ps tmp/4oacv1256672834.png") > system("convert tmp/53yrc1256672834.ps tmp/53yrc1256672834.png") > system("convert tmp/6sd7l1256672834.ps tmp/6sd7l1256672834.png") > system("convert tmp/7ylic1256672834.ps tmp/7ylic1256672834.png") > system("convert tmp/8m65n1256672834.ps tmp/8m65n1256672834.png") > > > proc.time() user system elapsed 1.599 1.175 2.178