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(-9879.41,-10788.3,-17642.546,-14437.08,-15375.902,-10005.122,-9551.41,-7988.232,-13723.944,-17598.3,-15783.122,-11085.766,-11790.766,-8022.766,-13348.3,-13524.3,-12618.012,-8935.3,-9100.3,-10968.122,-10056.944,-10411.944,-10946.588,-5283.232,-5128.054,-2249.054,-4387.054,-8762.588,-11380.656,-13290.368,-11371.902,-10899.724,-12171.368,-10352.19,-12691.012,-9346.834,-7929.012,-2859.368,-5897.19,-4573.546,-3579.258,-4843.724,-3116.902,4224.742,-2958.436,940.386,-455.08,3108.454,5254.454,3068.742,1027.208,1686.674,2374.208,5331.166,6855.344,10646.632,18059.208,20561.674,23339.386,38642.988,44831.056,40739.412,42120.056,37655.522,40053.7,41048.59,45168.768,-311562.65) > x <- c(-14592.498,-14749.83,-11156.16,-17184.822,-16545.82,-17444.154,-17099.494,-15654.83,-11063.164,-13154.828,-13161.16,-13948.494,-10852.162,-9392.162,-4035.162,-9891.16,-9131.16,-10197.824,-11863.16,-11729.16,-7285.494,-8177.828,-7750.828,-9981.496,-7517.164,-6005.498,-1075.498,-5927.498,-4997.496,-6932.492,-10592.156,-10866.154,-6412.488,-7672.156,-6610.49,-7920.824,-6428.158,-5585.824,-133.156,-3363.49,-2202.822,-2256.486,-3363.488,-3620.154,783.514,-1380.152,-1259.818,-3304.82,-347.822,1289.178,6757.514,1001.516,745.518,1461.516,2010.842,3153.508,11929.844,14782.516,15136.518,22871.182,32275.176,36322.172,44015.504,41091.172,40859.174,41557.84,41163.17,42609.836) > 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 -2042.49419 2 -2914.76170 3 -10605.51373 4 -5996.74355 5 -7084.30737 6 -1504.42030 7 -1130.93553 8 95.96503 9 -6708.55860 10 -10096.03363 11 -8279.38171 12 -3398.75634 13 -4824.49597 14 -1396.34321 15 -7968.83722 16 -6781.72441 17 -6052.34318 18 -2121.34159 19 -1898.69787 20 -3797.71133 21 -3920.89469 22 -4068.18425 23 -4702.22193 24 1480.37129 25 1061.92161 26 3589.04798 27 303.48164 28 -2942.64224 29 -5777.18874 30 -7236.48770 31 -4466.15411 32 -3930.19703 33 -6238.53011 34 -4126.13658 35 -6712.08478 36 -3062.89761 37 -1992.52657 38 2881.04559 39 -1426.00527 40 649.57029 41 1373.68719 42 121.71267 43 2106.21382 44 9507.60250 45 1299.37355 46 5701.83658 47 4278.36019 48 8317.91355 49 9775.60699 50 7208.84710 51 3894.43717 52 5893.73878 53 6640.86196 54 9431.15562 55 10827.46587 56 14352.77313 57 19722.46317 58 21560.90678 59 24256.21700 60 37759.40520 61 41758.48598 62 36724.81431 63 36314.66544 64 32530.83428 65 34983.01493 66 35815.27500 67 40027.32115 68 -317040.84030 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/16nat1257357184.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/2mrtx1257357184.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/3gocv1257357184.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/47orp1257357184.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/5wg7b1257357184.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/6drje1257357184.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/7we351257357184.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/842qr1257357184.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. -1.744e+04 -1.030e+04 -5.757e+03 -2.565e-02 1.073e+03 4.402e+04 > > #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/9bc251257357184.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/109qct1257357184.tab") > > system("convert tmp/16nat1257357184.ps tmp/16nat1257357184.png") > system("convert tmp/2mrtx1257357184.ps tmp/2mrtx1257357184.png") > system("convert tmp/3gocv1257357184.ps tmp/3gocv1257357184.png") > system("convert tmp/47orp1257357184.ps tmp/47orp1257357184.png") > system("convert tmp/5wg7b1257357184.ps tmp/5wg7b1257357184.png") > system("convert tmp/6drje1257357184.ps tmp/6drje1257357184.png") > system("convert tmp/7we351257357184.ps tmp/7we351257357184.png") > system("convert tmp/842qr1257357184.ps tmp/842qr1257357184.png") > > > proc.time() user system elapsed 1.675 1.219 2.939