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(282965,276610,277838,277051,277026,274960,270073,267063,264916,287182,291109,292223,288109,281400,282579,280113,280331,276759,275139,274275,271234,289725,290649,292223,278429,269749,265784,268957,264099,255121,253276,245980,235295,258479,260916,254586,250566,243345,247028,248464,244962,237003,237008,225477,226762,247857,248256,246892,245021,246186,255688,264242,268270,272969,273886,267353,271916,292633,295804,293222) > x <- c(111632,106707,108827,108413,106249,104861,102382,100320,100228,117089,121523,114948,112831,107605,108928,101993,102850,99925,101536,99450,98305,110159,109483,106810,96279,91982,90276,90999,86622,83117,80367,77550,77443,92844,92175,84822,81632,78872,81485,80651,78192,76844,76335,71415,73899,86822,86371,83469,82662,82880,89406,95378,97657,100247,99180,97493,101628,114585,115669,111311) > 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 -4521.3028 2 -4286.7236 3 -5895.2531 4 -6128.3271 5 -3257.9262 6 -3466.8021 7 -5036.9357 8 -5288.0094 9 -7311.9147 10 -7605.6904 11 -9611.3187 12 299.9368 13 -981.5476 14 -698.2347 15 -1289.3897 16 5523.5407 17 4594.8870 18 4936.4950 19 1161.0001 20 3088.0381 21 1579.0317 22 4209.5500 23 6038.0283 24 11188.4639 25 11484.7906 26 8554.1148 27 6871.7183 28 9077.3547 29 10075.7178 30 5787.3575 31 7621.8180 32 4094.9235 33 -6446.9121 34 -3869.2288 35 -537.1164 36 2971.0920 37 3219.2661 38 -308.8935 39 -122.0500 40 2429.8300 41 2217.9367 42 -3937.4587 43 -3251.4240 44 -8199.5347 45 -10238.0910 46 -6433.8793 47 -5431.4478 48 -2912.6135 49 -3703.8591 50 -2830.5399 51 -2060.2342 52 -1496.6844 53 -517.9536 54 715.6636 55 3060.2943 56 -1215.5240 57 -2185.0946 58 1195.6256 59 2916.2492 60 6165.1906 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1nyjj1257296905.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/2cb0g1257296905.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/3cn6y1257296905.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/4pvns1257296905.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/5ig121257296905.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/6pwt51257296905.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/71qbv1257296905.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/8ul651257296905.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. 71420 83380 97980 95860 106700 121500 > > #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/9z4261257296905.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/10hp281257296905.tab") > system("convert tmp/1nyjj1257296905.ps tmp/1nyjj1257296905.png") > system("convert tmp/2cb0g1257296905.ps tmp/2cb0g1257296905.png") > system("convert tmp/3cn6y1257296905.ps tmp/3cn6y1257296905.png") > system("convert tmp/4pvns1257296905.ps tmp/4pvns1257296905.png") > system("convert tmp/5ig121257296905.ps tmp/5ig121257296905.png") > system("convert tmp/6pwt51257296905.ps tmp/6pwt51257296905.png") > system("convert tmp/71qbv1257296905.ps tmp/71qbv1257296905.png") > system("convert tmp/8ul651257296905.ps tmp/8ul651257296905.png") > > > proc.time() user system elapsed 1.560 1.136 2.547