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.32855368,0.42855368,0.39703020,0.19703020,0.29703020,0.67325811,0.67325811,0.67325811,0.24509236,0.24509236,-0.15490764,0.16498877,0.16498877,0.26498877,0.15671943,0.15671943,0.35671943,0.86111308,0.96111308,0.96111308,1.29754817,0.99754817,0.39754817,0.12571391,-0.17428609,-0.07428609,-0.01847255,0.08152745,0.18152745,0.47377607,0.37377607,0.17377607,0.45000397,0.25000397,-0.14999603,-0.21847255,-0.31847255,-0.51847255,-0.26601675,-0.36601675,-0.06601675,0.15387966,0.15387966,-0.24612034,-0.22570597,-0.52570597,-0.22570597,-0.18307339,-0.08307339,-0.48307339,-0.43397531,-0.73397531,-0.33397531,0.00529954,0.60529954,0.80529954,0.71744457,0.41744457,0.51744457,1.01744457,1.11744457) > x <- c(0.78810564,0.78810564,0.67709631,0.17709631,0.27709631,0.71096141,0.81096141,0.71096141,0.24087770,0.14087770,-0.05912230,0.53457538,0.63457538,0.63457538,0.15818935,0.05818935,0.15818935,0.76213817,0.76213817,0.66213817,1.00860791,0.80860791,0.50860791,0.87869162,0.77869162,0.77869162,0.48734744,0.38734744,0.38734744,0.74247301,0.74247301,0.64247301,0.97633811,0.67633811,0.17633811,-0.01265256,-0.21265256,-0.51265256,-0.04492235,-0.04492235,0.15507765,0.14877533,-0.05122467,-0.35122467,-0.32601540,-0.62601540,-0.22601540,-0.42920601,-0.22920601,-0.62920601,-0.10240143,-0.40240143,-0.10240143,-0.04651766,0.25348234,0.25348234,0.10230559,-0.29769441,-0.19769441,0.50230559,0.70230559) > 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.23996194 2 -0.13996194 3 -0.09333954 4 0.05863935 5 0.08824357 6 0.15904877 7 0.08865300 8 0.15904877 9 0.06180210 10 0.13219788 11 -0.12701057 12 -0.22505225 13 -0.29544803 14 -0.19544803 15 0.03163828 16 0.10203405 17 0.23163828 18 0.31087747 19 0.41087747 20 0.48127324 21 0.57380827 22 0.41459982 23 0.02578715 24 -0.50657041 25 -0.73617463 26 -0.63617463 27 -0.37526710 28 -0.20487132 29 -0.10487132 30 -0.06261610 31 -0.16261610 32 -0.29222033 33 -0.25101936 34 -0.23983203 35 -0.28785314 36 -0.22328821 37 -0.18249666 38 -0.17130933 39 -0.24811584 40 -0.34811584 41 -0.18890740 42 0.03542558 43 0.17621713 44 -0.01259554 45 -0.00992743 46 -0.09874010 47 -0.08032321 48 0.10534698 49 0.06455543 50 -0.05386147 51 -0.37561156 52 -0.46442423 53 -0.27561156 54 0.02432348 55 0.41313615 56 0.61313615 57 0.63170322 58 0.61328633 59 0.64289055 60 0.65012012 61 0.60932856 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1343n1257357681.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/2yzjy1257357681.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/3go5d1257357681.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/49asl1257357681.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/55eym1257357681.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/62ds91257357681.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/74ez01257357681.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/8j8i71257357681.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. -0.62920 -0.05122 0.25350 0.27670 0.70230 1.00900 > > #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/9bog31257357681.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/1002fq1257357681.tab") > > system("convert tmp/1343n1257357681.ps tmp/1343n1257357681.png") > system("convert tmp/2yzjy1257357681.ps tmp/2yzjy1257357681.png") > system("convert tmp/3go5d1257357681.ps tmp/3go5d1257357681.png") > system("convert tmp/49asl1257357681.ps tmp/49asl1257357681.png") > system("convert tmp/55eym1257357681.ps tmp/55eym1257357681.png") > system("convert tmp/62ds91257357681.ps tmp/62ds91257357681.png") > system("convert tmp/74ez01257357681.ps tmp/74ez01257357681.png") > system("convert tmp/8j8i71257357681.ps tmp/8j8i71257357681.png") > > > proc.time() user system elapsed 1.636 1.186 4.033