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(0.169087676,-0.973912324,-0.195912324,3.597087676,1.985087676,-1.740912324,2.351087676,-5.182912324,4.311087676,-0.247912324,4.116087676,3.221087676,-3.128912324,-2.453912324,6.728087676,1.687087676,0.688087676,-2.350912324,-0.532912324,2.714087676,1.803087676,-5.104912324,0.650087676,-4.779912324,1.001087676,0.182087676,2.623087676,-3.167912324,3.792087676,7.348087676,-1.804912324,-2.012912324,3.037087676,-4.884912324,-1.467912324,-5.521912324,-0.700912324,5.520087676,1.038087676,-3.311912324,-4.895912324,-1.417912324,-0.388912324,-0.987912324,2.038087676,0.948087676,1.025087676,-2.181912324,0.208087676,-3.520912324,-0.635912324,-0.778912324,4.244087676,-2.961912324,2.208087676,-2.207912324,-2.117912324,0.049087676,-2.467912324,2.390087676) > x <- c(64.42592896,47.69064634,61.95277662,69.48479846,66.46888521,72.11049407,75.08901594,51.9287114,74.0142332,70.04903748,61.37521144,54.3296681,52.12640731,44.72803771,43.39112469,55.16936356,56.31634195,60.38853759,46.72545061,53.26821152,60.80579823,51.78432011,41.53551598,37.18268971,43.88575516,44.40186375,50.43666803,42.19860296,52.12382022,60.64808078,42.37779853,39.76284198,67.37262435,52.22823305,46.60512454,54.40742862,37.18527681,42.77616814,56.51960273,52.31634195,40.54625504,48.2149069,52.60771163,42.56773317,44.51960273,39.83503763,64.54366795,55.07568979,35.35373332,45.55440701,41.06495073,41.3296681,59.84060251,47.51960273,52.35373332,52.12382022,39.80838532,48.20158074,43.60512454,40.0168203) > 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.99183425 2 -0.57419981 3 -1.12620255 4 1.96440521 5 0.63365162 6 -3.61845178 7 0.19578871 8 -5.17841693 9 2.25601666 10 -1.93321242 11 3.23965780 12 3.00168391 13 -3.14285290 14 -1.77792428 15 7.52874840 16 1.38937883 17 0.28341834 18 -3.13533078 19 -0.04319131 20 2.59366913 21 0.97975794 22 -5.08695185 23 1.62379160 24 -3.40028932 25 1.75562206 26 0.88849280 27 2.76672229 28 -2.25604401 29 3.77838836 30 6.53946575 31 -0.90975474 32 -0.87389920 33 1.60137420 34 -4.90834857 35 -0.96697040 36 -5.74856758 37 0.67846943 38 6.37809565 39 0.61446343 40 -3.34356509 41 -3.82995572 42 -1.06708928 43 -0.44773652 44 -0.11046693 45 2.73351315 46 2.08036825 47 -0.14681390 48 -2.47088571 49 1.75826845 50 -2.92198664 51 0.38167376 52 0.21398777 53 3.51076644 54 -2.54624928 55 2.17294801 56 -2.22161164 57 -0.98314631 58 0.40115344 59 -1.68720797 60 3.50541626 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/16s1y1260022345.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/2okkc1260022345.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/3d0fx1260022345.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/462b71260022345.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/50t3q1260022345.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/64xzb1260022345.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/70yqd1260022345.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/8kaxd1260022345.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. 35.35 43.24 51.86 51.54 57.35 75.09 > > #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/99n7m1260022345.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/10yypk1260022345.tab") > > system("convert tmp/16s1y1260022345.ps tmp/16s1y1260022345.png") > system("convert tmp/2okkc1260022345.ps tmp/2okkc1260022345.png") > system("convert tmp/3d0fx1260022345.ps tmp/3d0fx1260022345.png") > system("convert tmp/462b71260022345.ps tmp/462b71260022345.png") > system("convert tmp/50t3q1260022345.ps tmp/50t3q1260022345.png") > system("convert tmp/64xzb1260022345.ps tmp/64xzb1260022345.png") > system("convert tmp/70yqd1260022345.ps tmp/70yqd1260022345.png") > system("convert tmp/8kaxd1260022345.ps tmp/8kaxd1260022345.png") > > > proc.time() user system elapsed 1.640 1.213 2.419