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(2431.473354,2851.273553,5193.987643,4067.181965,5531.37159,5825.944194,4975.147524,5115.912101,7766.480008,4520.081772,5629.786475,5784.933441,3763.320134,4130.870429,5680.303305,5760.748704,5928.343033,4692.513096,5264.49685,5171.667497,6929.501746,4855.894509,5940.796465,6459.532472,5574.916233,4500.753023,5893.745786,7642.71624,6962.737381,6254.881998,7521.924074,7790.512333,8175.20745,8684.919782,7171.695709,9552.697275,7684.812346,5972.72349,8338.660273,8331.870436,5683.701348,4156.620731,3554.20292,3725.280605,4817.77689,3849.022097,3350.142064,5422.69882,3864.370641) > x <- c(-7426.73,-7308.93,-7333.61,-7314.22,-7239.23,-7219.76,-7313.35,-7381.09,-7077.32,-7400.02,-7147.91,-7144.17,-7276.58,-7172.73,-7211.50,-6941.45,-7026.76,-7075.19,-7106.10,-7162.73,-7003.40,-6999.41,-6846.00,-6948.87,-6927.68,-7122.45,-7030.05,-6802.68,-6819.76,-7054.22,-6787.48,-7167.89,-6868.79,-6666.08,-6597.60,-6457.10,-6408.49,-6864.88,-6508.34,-6686.73,-6630.20,-6614.38,-7002.80,-6940.62,-6789.02,-6994.08,-7139.56,-6908.50,-6912.93) > 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 -1568.757830 2 -1610.218820 3 829.133013 4 -373.596727 5 796.959820 6 1015.295112 7 530.962234 8 936.971574 9 2398.088618 10 415.264117 11 537.799392 12 678.301903 13 -824.842863 14 -863.930722 15 837.311121 16 -139.659306 17 361.977401 18 -684.218586 19 8.797285 20 137.710048 21 1271.667002 22 -817.563598 23 -333.358409 24 588.178435 25 -379.410000 26 -690.925994 27 340.262576 28 1198.936283 29 585.836381 30 796.039560 31 1018.626544 32 2776.759533 33 1990.289779 34 1706.264795 35 -75.101606 36 1755.753974 37 -302.469720 38 -227.504294 39 742.353842 40 1434.073204 41 -1435.446436 42 -3024.472316 43 -2105.981202 44 -2178.377378 45 -1679.490570 46 -1845.306317 47 -1774.540528 48 -606.729192 49 -2147.711131 > library(lattice) > postscript(file="/var/www/rcomp/tmp/16t3p1257628521.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/2ueqc1257628521.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/3y7271257628521.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/419571257628521.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/5bkqq1257628521.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/6whal1257628521.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/7vm8i1257628521.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/8mb691257628521.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. -7427 -7168 -7003 -6995 -6846 -6408 > > #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/9rmq61257628521.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/105u131257628521.tab") > > system("convert tmp/16t3p1257628521.ps tmp/16t3p1257628521.png") > system("convert tmp/2ueqc1257628521.ps tmp/2ueqc1257628521.png") > system("convert tmp/3y7271257628521.ps tmp/3y7271257628521.png") > system("convert tmp/419571257628521.ps tmp/419571257628521.png") > system("convert tmp/5bkqq1257628521.ps tmp/5bkqq1257628521.png") > system("convert tmp/6whal1257628521.ps tmp/6whal1257628521.png") > system("convert tmp/7vm8i1257628521.ps tmp/7vm8i1257628521.png") > system("convert tmp/8mb691257628521.ps tmp/8mb691257628521.png") > > > proc.time() user system elapsed 1.990 1.790 2.862