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(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(15912.8,13866.5,17823.2,17872,17420.4,16704.4,15991.2,16583.6,19123.5,17838.7,17209.4,18586.5,16258.1,15141.6,19202.1,17746.5,19090.1,18040.3,17515.5,17751.8,21072.4,17170,19439.5,19795.4,17574.9,16165.4,19464.6,19932.1,19961.2,17343.4,18924.2,18574.1,21350.6,18594.6,19823.1,20844.4,19640.2,17735.4,19813.6,22160,20664.3,17877.4,20906.5,21164.1,21374.4,22952.3,21343.5,23899.3,22392.9,18274.1,22786.7,22321.5,17842.2,16373.5,15993.8,16446.1,17729,16643,16196.7,18252.1,17304) > 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 -19.3670574 2 -40.9038324 3 -89.4944018 4 -43.1509210 5 -15.6024764 6 -79.7060051 7 -30.9185145 8 -77.7185558 9 -80.0649346 10 -28.7441159 11 7.8742770 12 -8.8425812 13 0.1254405 14 27.2064602 15 -47.5170333 16 4.4516029 17 8.4421913 18 -19.7907201 19 24.6925035 20 -43.5653961 21 -18.0157625 22 22.9006471 23 -16.4784610 24 10.3800388 25 -4.0980138 26 -15.7772370 27 -50.1589658 28 0.6415924 29 4.0482582 30 15.3444905 31 -20.4257074 32 -19.0028099 33 10.2919494 34 56.2314392 35 13.7911949 36 13.8155161 37 19.9778214 38 25.8872046 39 -24.7783352 40 -11.2040894 41 19.5931620 42 -7.8682408 43 8.9163389 44 -3.1098776 45 -24.3843858 46 -2.5452824 47 98.6147217 48 3.7173458 49 24.3489160 50 48.3593987 51 -60.8141432 52 16.0779216 53 21.7446583 54 6.8553110 55 28.3731463 56 -67.4775435 57 0.2077317 58 52.5909269 59 179.9223726 60 74.8299607 61 121.2708606 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/19umo1257368505.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/2l3ul1257368505.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/3k5v41257368505.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/4m9km1257368505.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/5rnwp1257368505.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/66a8k1257368505.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/7fewb1257368505.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/85kkx1257368505.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. 13870 17300 18250 18690 19930 23900 > > #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/9voup1257368505.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/1045lb1257368505.tab") > > system("convert tmp/19umo1257368505.ps tmp/19umo1257368505.png") > system("convert tmp/2l3ul1257368505.ps tmp/2l3ul1257368505.png") > system("convert tmp/3k5v41257368505.ps tmp/3k5v41257368505.png") > system("convert tmp/4m9km1257368505.ps tmp/4m9km1257368505.png") > system("convert tmp/5rnwp1257368505.ps tmp/5rnwp1257368505.png") > system("convert tmp/66a8k1257368505.ps tmp/66a8k1257368505.png") > system("convert tmp/7fewb1257368505.ps tmp/7fewb1257368505.png") > system("convert tmp/85kkx1257368505.ps tmp/85kkx1257368505.png") > > > proc.time() user system elapsed 1.634 1.176 2.880