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(99.026,101.851,99.958,97.875,97.927,95.149,94.551,93.999,93.297,89.901,89.742,87.096,86.863,86.718,80.020,63.483,51.289,44.071,43.654,66.115,84.518,83.395,78.307,80.049,78.346,78.317,75.918,73.739,74.530,74.179,76.974,75.408,73.336,69.210,67.286,64.606,64.159,64.423,66.411,64.270,56.521,50.599,54.751,62.227,63.932,65.391,75.744,74.590,76.035,74.427,73.354,73.081,75.309,75.463,75.910,76.151,76.882,78.632,80.137,82.490,79.896,81.303,79.344,81.355,82.328,79.669,77.249,75.101,72.520,72.438,72.653,71.429,69.189,66.451,63.354,61.379,61.880,62.274,62.429,63.905,63.917,64.295,61.930,60.440,59.353,58.695,60.569,60.386,60.938,61.795,63.304,64.270,63.492,61.333,59.341,58.412,58.725,59.277,58.562,57.858,58.790,58.243,57.044,57.339,59.429,60.575,61.950,61.712) > x <- c(94.204,97.217,95.118,93.688,93.140,91.516,90.957,90.372,89.749,85.813,86.026,83.933,83.602,83.384,76.369,60.808,48.071,42.604,41.402,62.121,79.739,79.006,74.472,75.956,75.041,74.873,72.922,70.472,71.423,71.363,73.297,72.081,70.488,65.544,64.450,61.698,61.352,61.072,63.722,61.987,53.802,47.818,50.998,58.438,60.143,61.854,70.987,70.389,72.175,70.243,69.616,69.443,70.833,71.059,72.218,72.647,73.299,73.756,75.557,78.172,75.624,76.959,74.994,76.841,78.043,75.187,73.387,70.798,68.722,68.396,68.466,67.675,65.248,62.974,59.801,57.894,58.592,59.249,59.554,59.753,60.877,60.532,58.452,56.955,56.437,55.588,56.702,57.062,57.826,58.755,60.250,61.142,60.690,58.495,56.020,55.814,56.489,56.587,55.714,55.611,56.093,55.929,54.181,54.810,56.189,57.427,59.432,58.951) > 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 0.312330033 2 0.009995004 3 0.295646257 4 -0.303089192 5 0.317705894 6 -0.774667791 7 -0.792455285 8 -0.737256151 9 -0.792615022 10 -0.103254692 11 -0.483337454 12 -0.956913885 13 -0.846353349 14 -0.765080851 15 -0.181880976 16 -0.567384004 17 0.458949967 18 -1.084592482 19 -0.253979902 20 0.701791272 21 0.818236832 22 0.456052157 23 0.074104935 24 0.275791233 25 -0.477487044 26 -0.332111908 27 -0.706076846 28 -0.342106113 29 -0.538193936 30 -0.826917102 31 -0.039307061 32 -0.343163219 33 -0.761713269 34 0.243897876 35 -0.544587845 36 -0.368157046 37 -0.456027302 38 0.098597925 39 -0.663962256 40 -1.004123798 41 -0.257525654 42 0.031550618 43 0.882878401 44 0.636550950 45 0.571850909 46 0.254923185 47 1.128351059 48 0.595043508 49 0.186269740 50 0.583583804 51 0.161376723 52 0.067941595 53 0.853194934 54 0.772618858 55 0.016638009 56 -0.187641356 57 -0.133382955 58 1.142275157 59 0.777932181 60 0.416700154 61 0.467389716 62 0.488730153 63 0.569296476 64 0.663207928 65 0.388595347 66 0.693972659 67 0.142277688 68 0.681523087 69 0.255301554 70 0.511672353 71 0.654016047 72 0.251032312 73 0.530130259 74 0.152422278 75 0.348828865 76 0.353194248 77 0.129707075 78 -0.158224260 79 -0.319798168 80 0.949650332 81 -0.205002364 82 0.531089433 83 0.325019689 84 0.388826704 85 -0.160516627 86 0.062700579 87 0.780427355 88 0.223766350 89 -0.017225340 90 -0.124478324 91 -0.167209445 92 -0.127058382 93 -0.435906230 94 -0.316612043 95 0.260307372 96 -0.454875497 97 -0.842489883 98 -0.392208712 99 -0.201080773 100 -0.798172208 101 -0.366462777 102 -0.743239430 103 -0.127907657 104 -0.485776470 105 0.172894288 106 0.033915608 107 -0.672168605 108 -0.410915983 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1nycx1260472335.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/2g7xw1260472335.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/309b71260472335.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/48r591260472335.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/5duqm1260472335.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/64gij1260472335.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/7n0nf1260472335.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/84rtx1260472335.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. 41.40 58.48 66.61 67.61 74.90 97.22 > > #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/934hn1260472335.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/10xx381260472335.tab") > > system("convert tmp/1nycx1260472335.ps tmp/1nycx1260472335.png") > system("convert tmp/2g7xw1260472335.ps tmp/2g7xw1260472335.png") > system("convert tmp/309b71260472335.ps tmp/309b71260472335.png") > system("convert tmp/48r591260472335.ps tmp/48r591260472335.png") > system("convert tmp/5duqm1260472335.ps tmp/5duqm1260472335.png") > system("convert tmp/64gij1260472335.ps tmp/64gij1260472335.png") > system("convert tmp/7n0nf1260472335.ps tmp/7n0nf1260472335.png") > system("convert tmp/84rtx1260472335.ps tmp/84rtx1260472335.png") > > > proc.time() user system elapsed 1.643 1.213 2.137