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(5560,3922,3759,4138,4634,3996,4308,4429,5219,4929,5755,5592,4163,4962,5208,4755,4491,5732,5731,5040,6102,4904,5369,5578,4619,4731,5011,5299,4146,4625,4736,4219,5116,4205,4121,5103,4300,4578,3809,5526,4247,3830,4394,4826,4409,4569,4106,4794,3914,3793,4405,4022,4100,4788,3163,3585,3903,4178,3863,4187) > x <- c(5560,3922,3759,4138,4634,3996,4308,4429,5219,4929,5755,5592,4163,4962,5208,4755,4491,5732,5731,5040,6102,4904,5369,5578,4619,4731,5011,5299,4146,4625,4736,4219,5116,4205,4121,5103,4300,4578,3809,5526,4247,3830,4394,4826,4409,4569,4106,4794,3914,3793,4405,4022,4100,4788,3163,3585,3903,4178,3863,4187) > 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 2.771101e-13 2 -3.378101e-12 3 1.461352e-13 4 1.468345e-13 5 3.320039e-14 6 1.750692e-13 7 7.860608e-14 8 9.457751e-14 9 1.546020e-15 10 -2.438639e-15 11 -1.696279e-14 12 -1.365368e-15 13 4.819204e-14 14 1.741995e-14 15 -5.073512e-15 16 2.075010e-14 17 7.504417e-14 18 -3.080363e-14 19 -3.140540e-14 20 -4.932839e-14 21 -3.552034e-14 22 1.093868e-14 23 -1.355613e-13 24 -1.234771e-13 25 3.838461e-14 26 2.762377e-14 27 -9.936461e-15 28 -6.399877e-14 29 3.796186e-14 30 4.199526e-14 31 2.352722e-14 32 8.189148e-14 33 -6.043686e-14 34 7.346662e-14 35 1.366043e-13 36 -1.141653e-14 37 7.379188e-14 38 4.213352e-14 39 1.762240e-13 40 -4.108256e-14 41 9.874119e-14 42 7.517445e-14 43 7.351536e-14 44 2.084361e-14 45 8.254200e-14 46 6.513925e-14 47 1.275777e-13 48 3.000850e-14 49 1.257236e-13 50 1.665956e-13 51 8.013489e-14 52 7.702853e-14 53 1.239670e-13 54 1.218699e-14 55 2.422243e-13 56 2.688000e-13 57 1.191041e-13 58 1.709055e-13 59 9.503305e-14 60 6.263466e-14 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/19evf1260732765.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/2r0751260732765.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/3jhr01260732765.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/4in3b1260732765.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/5oc471260732765.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/602a51260732765.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/7dcsa1260732765.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/8l5gr1260732765.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. 3163 4134 4530 4592 5018 6102 > > #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/97yeq1260732765.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/10i7qu1260732765.tab") > > try(system("convert tmp/19evf1260732765.ps tmp/19evf1260732765.png",intern=TRUE)) character(0) > try(system("convert tmp/2r0751260732765.ps tmp/2r0751260732765.png",intern=TRUE)) character(0) > try(system("convert tmp/3jhr01260732765.ps tmp/3jhr01260732765.png",intern=TRUE)) character(0) > try(system("convert tmp/4in3b1260732765.ps tmp/4in3b1260732765.png",intern=TRUE)) character(0) > try(system("convert tmp/5oc471260732765.ps tmp/5oc471260732765.png",intern=TRUE)) character(0) > try(system("convert tmp/602a51260732765.ps tmp/602a51260732765.png",intern=TRUE)) character(0) > try(system("convert tmp/7dcsa1260732765.ps tmp/7dcsa1260732765.png",intern=TRUE)) character(0) > try(system("convert tmp/8l5gr1260732765.ps tmp/8l5gr1260732765.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.571 1.139 1.915