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(9.250992752,9.431626199,9.424209044,9.414643553,9.466524037,9.349867504,9.404425796,9.54103883,9.445949899,9.395499566,9.487949381,9.294800999,9.332664194,9.521047814,9.434842999,9.545461697,9.56631407,9.505618521,9.515299827,9.693772188,9.470394277,9.552503527,9.563459,9.410288989,9.439943018,9.556083784,9.561757518,9.573489314,9.483629359,9.526223529,9.519434071,9.640810239,9.495992886,9.574372188,9.609780701,9.54862525,9.468943727,9.57110793,9.686164529,9.643005516,9.595990453,9.678642555,9.695318817,9.718747073,9.748948464,9.656493066,9.79834368,9.688814277,9.576627966,9.728503014,9.72807408,9.556324371,9.442007494,9.393036858,9.407172802,9.4931104,9.417297629,9.375905657,9.537721409,9.414879937) > x <- c(9.280220849,9.542438772,9.54536871,9.532959959,9.470694926,9.434267616,9.467622514,9.609673384,9.530400086,9.473673398,9.550370557,9.377252139,9.358173998,9.579570173,9.518993506,9.59790624,9.538254665,9.51247993,9.516647909,9.690925321,9.492552512,9.598449058,9.647723956,9.484519184,9.443133219,9.617909931,9.64551961,9.643939319,9.480817789,9.596744977,9.5595878,9.692902314,9.574455568,9.625135156,9.677847137,9.571595809,9.490257374,9.629188855,9.744257327,9.685188498,9.499136823,9.705182945,9.714691079,9.715892113,9.773447202,9.688411372,9.824677002,9.705195138,9.549117094,9.747365765,9.75017319,9.538189825,9.422414887,9.448057215,9.442150262,9.516625824,9.460811111,9.421176497,9.544452683,9.481458517) > 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 1.091516e-02 2 -7.068256e-02 3 -8.102980e-02 4 -7.818592e-02 5 3.596275e-02 6 -4.426464e-02 7 -2.306293e-02 8 -2.850794e-02 9 -4.431957e-02 10 -3.804035e-02 11 -2.229157e-02 12 -4.231279e-02 13 1.462951e-02 14 -1.839422e-02 15 -4.401931e-02 16 -1.231733e-02 17 6.818963e-02 18 3.327012e-02 19 3.878323e-02 20 4.296938e-02 21 1.797430e-02 22 -5.818348e-03 23 -4.414026e-02 24 -3.409726e-02 25 3.694483e-02 26 -2.169995e-02 27 -4.363729e-02 28 -3.032512e-02 29 4.294469e-02 30 -3.039418e-02 31 -2.458372e-05 32 -1.196966e-02 33 -3.833429e-02 34 -1.063713e-02 35 -2.794326e-02 36 1.715798e-02 37 1.881900e-02 38 -1.795529e-02 39 -1.797298e-02 40 -2.060180e-03 41 1.369858e-01 42 1.358140e-02 43 2.074905e-02 44 4.297621e-02 45 1.561961e-02 46 8.204333e-03 47 1.378244e-02 48 2.374093e-02 49 6.764055e-02 50 2.125691e-02 51 1.802041e-02 52 5.826477e-02 53 5.972868e-02 54 -1.488558e-02 55 5.157616e-03 56 1.661589e-02 57 -3.379348e-03 58 -5.134704e-03 59 3.339864e-02 60 -2.644549e-02 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1pq5x1256766763.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/20f8b1256766763.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/3bw7q1256766763.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/416tb1256766763.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/5t6jo1256766763.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/6ju6p1256766763.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/7gpf41256766763.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/8mrw11256766763.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. 9.280 9.484 9.547 9.566 9.646 9.825 > > #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/9dy0k1256766763.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/10htxz1256766763.tab") > > system("convert tmp/1pq5x1256766763.ps tmp/1pq5x1256766763.png") > system("convert tmp/20f8b1256766763.ps tmp/20f8b1256766763.png") > system("convert tmp/3bw7q1256766763.ps tmp/3bw7q1256766763.png") > system("convert tmp/416tb1256766763.ps tmp/416tb1256766763.png") > system("convert tmp/5t6jo1256766763.ps tmp/5t6jo1256766763.png") > system("convert tmp/6ju6p1256766763.ps tmp/6ju6p1256766763.png") > system("convert tmp/7gpf41256766763.ps tmp/7gpf41256766763.png") > system("convert tmp/8mrw11256766763.ps tmp/8mrw11256766763.png") > > > proc.time() user system elapsed 1.740 1.560 3.216