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(26672520,28108344,34113075,29226944,21199149,23834985,18699714,18266456,20745146,23902320,20018988,14930930,30402222,26854866,30670512,27827172,23669415,28213865,20335887,20995391,22385060,22664808,21230195,12520284,34721336,32423450,38013200,29601180,29306085,26725293,22136480,20816378,21819660,24500784,19733590,11813970,31486686,27027819,31772636,25302178,24258192,25198003,22232745,19294185,19978120,24429612,18654270,12270208,29611692,28645612,28424901,30527000,22947701,24458304,20927808,17735742,19749786,21905246,15361200,11329296) > x <- c(26672520,28108344,34113075,29226944,21199149,23834985,18699714,18266456,20745146,23902320,20018988,14930930,30402222,26854866,30670512,27827172,23669415,28213865,20335887,20995391,22385060,22664808,21230195,12520284,34721336,32423450,38013200,29601180,29306085,26725293,22136480,20816378,21819660,24500784,19733590,11813970,31486686,27027819,31772636,25302178,24258192,25198003,22232745,19294185,19978120,24429612,18654270,12270208,29611692,28645612,28424901,30527000,22947701,24458304,20927808,17735742,19749786,21905246,15361200,11329296) > 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 3.329991e-10 2 2.443643e-09 3 5.266965e-10 4 2.859345e-10 5 -1.096315e-10 6 2.024818e-11 7 -2.327900e-10 8 6.771840e-10 9 3.336590e-10 10 2.356608e-11 11 -1.677834e-10 12 -4.184951e-10 13 3.438458e-10 14 1.690515e-10 15 -5.742569e-10 16 -2.486999e-10 17 1.208979e-11 18 -2.296458e-10 19 -1.521683e-10 20 3.459897e-10 21 -5.119622e-11 22 -3.741177e-11 23 -1.081017e-10 24 -5.372786e-10 25 5.566682e-10 26 -4.878816e-10 27 -1.143772e-09 28 3.043749e-10 29 -6.414884e-10 30 1.626668e-10 31 -6.344489e-11 32 -1.284923e-10 33 -7.905606e-11 34 5.305513e-11 35 -1.818462e-10 36 1.290563e-09 37 -5.340403e-10 38 -2.880876e-10 39 -5.199502e-10 40 9.254346e-11 41 4.110151e-11 42 8.741028e-11 43 -5.870148e-11 44 -2.034977e-10 45 -1.697971e-10 46 4.954816e-11 47 -2.350292e-10 48 -5.496010e-10 49 3.048928e-10 50 2.572897e-10 51 2.464142e-10 52 -5.813284e-10 53 -2.347234e-11 54 5.096194e-11 55 3.426596e-10 56 6.510333e-10 57 -1.810482e-10 58 -7.483884e-11 59 -3.972938e-10 60 -5.959640e-10 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1z2811256771266.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/21phw1256771266.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/3ixy11256771266.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/4ep9q1256771266.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/5vosg1256771266.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/650lb1256771266.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/77kex1256771266.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/8r0o31256771266.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. 11330000 20260000 23750000 23880000 28270000 38010000 > > #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/9wxek1256771266.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/10xfcm1256771266.tab") > > system("convert tmp/1z2811256771266.ps tmp/1z2811256771266.png") > system("convert tmp/21phw1256771266.ps tmp/21phw1256771266.png") > system("convert tmp/3ixy11256771266.ps tmp/3ixy11256771266.png") > system("convert tmp/4ep9q1256771266.ps tmp/4ep9q1256771266.png") > system("convert tmp/5vosg1256771266.ps tmp/5vosg1256771266.png") > system("convert tmp/650lb1256771266.ps tmp/650lb1256771266.png") > system("convert tmp/77kex1256771266.ps tmp/77kex1256771266.png") > system("convert tmp/8r0o31256771266.ps tmp/8r0o31256771266.png") > > > proc.time() user system elapsed 1.644 1.207 2.950