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(200.1,172,136.1,182.6,208.7,142.3,188.8,143.9,149.7,196.9,231.5,219.2,220.7,244.2,182.5,229.8,238.1,206.5,249.3,181.8,218,246.4,214.3,242.3,220.7,204.5,180.7,233,236.5,239.4,208.7,209,247.2,284.3,245.8,249.1,251.4,251.2,207.2,228.3,254.3,217.9,244.4,233.2,212.6,239.5,335.5,248.8,264.6,275.4,180.7,256.1,247.4,227.8,248.1,153.7,225.5,274.4,400.3,301.8,345.2) > x <- c(14497,14398.3,16629.6,16670.7,16614.8,16869.2,15663.9,16359.9,18447.7,16889,16505,18320.9,15052.1,15699.8,18135.3,16768.7,18883,19021,18101.9,17776.1,21489.9,17065.3,18690,18953.1,16398.9,16895.6,18553,19270,19422.1,17579.4,18637.3,18076.7,20438.6,18075.2,19563,19899.2,19227.5,17789.6,19220.8,21968.9,21131.5,19484.6,22168.7,20866.8,22176.2,23533.8,21479.6,24347.7,22751.6,20328.3,23650.4,23335.7,19614.9,18042.3,17282.5,16847.2,18159.5,16540.9,15952.7,18357.8,16394.3) > 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 -12.9907720 2 -40.7269238 3 -84.8523998 4 -38.5039110 5 -12.1978410 6 -79.5356625 7 -28.5924383 8 -76.0581763 9 -77.9546531 10 -25.0086533 11 11.0069263 12 -7.9872170 13 5.5629045 14 26.6752198 15 -44.0030201 16 8.3348212 17 8.8406547 18 -23.2680693 19 22.9201058 20 -43.3788634 21 -20.8694351 22 23.8414335 23 -14.2478691 24 12.7822377 25 0.5980539 26 -17.4329836 27 -47.3428316 28 2.3140158 29 5.2533136 30 14.9462525 31 -19.6535956 32 -17.2869968 33 12.2060827 34 58.0185328 35 14.0338991 36 16.0945297 37 20.8706881 38 25.9713701 39 -23.3046130 40 -12.3352232 41 16.7517725 42 -13.5770867 43 3.0282330 44 -3.3724360 45 -28.7994150 46 -6.9040788 47 96.6685349 48 -0.6044440 49 21.0794274 50 40.8126932 51 -66.1339136 52 10.4261981 53 15.4425747 54 1.6398155 55 24.7407462 56 -68.0545616 57 -1.0922311 58 53.7745844 59 181.8429279 60 74.4767547 61 125.1150114 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1vk1h1257165165.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/2vseg1257165165.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/3wvgx1257165165.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/4jptr1257165165.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/5xy3m1257165165.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/6j61e1257165165.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/7rjsg1257165165.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/8dj3p1257165165.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. 14400 16850 18320 18640 19610 24350 > > #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/9awcm1257165165.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/102gus1257165165.tab") > > system("convert tmp/1vk1h1257165165.ps tmp/1vk1h1257165165.png") > system("convert tmp/2vseg1257165165.ps tmp/2vseg1257165165.png") > system("convert tmp/3wvgx1257165165.ps tmp/3wvgx1257165165.png") > system("convert tmp/4jptr1257165165.ps tmp/4jptr1257165165.png") > system("convert tmp/5xy3m1257165165.ps tmp/5xy3m1257165165.png") > system("convert tmp/6j61e1257165165.ps tmp/6j61e1257165165.png") > system("convert tmp/7rjsg1257165165.ps tmp/7rjsg1257165165.png") > system("convert tmp/8dj3p1257165165.ps tmp/8dj3p1257165165.png") > > > proc.time() user system elapsed 2.070 2.040 4.093