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.26,0.64,1.66,0.99,0.56,1.36,0.5,-0.45,0.93,0.95,1.2,1.05,0.7,0.85,1.68,1.17,0.89,1.47,0.26,-0.15,1.02,0.77,0.91,0.49,0.13,0.18,1.01,-0.09,0.21,0.45,-0.73,-0.72,-0.03,0.23,0.21,-0.7,-0.5,-0.35,0.42,-0.64,-0.53,-0.63,-1.15,-1.4,-1.07,-0.36,-0.43,-1.33,-0.83,-0.59,-0.49,-0.37,-0.94,-0.6,-1.45,-2.08,-0.83,-0.61,-1.47,-1.59) > x <- c(8.94,9.9,-7.23,2.26,7.69,-7.6,4.34,16.5,-4.8,-3.29,-6.12,-2.88,6.36,7.98,-6.18,-1.03,3.47,-7.91,8.09,11.78,-7.7,-3.79,-9.5,-1.54,4.47,5.78,-11.62,4.9,-4.84,-8.96,8.07,8.29,-5.51,-11.48,-14.33,-1.61,-3.47,-0.52,-13.1,-0.39,-5.2,-2.64,1.84,4.25,-5.15,-16.31,-15.08,0.4,-6.1,-5.76,-4.52,-7.79,-1.29,-8.74,3.27,15.14,-7.65,-11.33,3.6,9.53) > 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.56487373 2 0.97314497 3 1.48868010 4 1.09815305 5 0.82806223 6 1.17778390 7 0.66940739 8 0.07750971 9 0.83024167 10 0.89470997 11 1.06136872 12 1.00678414 13 0.92889479 14 1.12660250 15 1.53960177 16 1.18126517 17 1.03378659 18 1.27865465 19 0.53984191 20 0.23850947 21 0.83483898 22 0.69998537 23 0.67183041 24 0.48624608 25 0.30323579 26 0.39181425 27 0.70939810 28 0.09589895 29 0.10906370 30 0.22773298 31 -0.45074707 32 -0.43426825 33 -0.15066726 34 -0.06647901 35 -0.17040924 36 -0.70581537 37 -0.56059089 38 -0.32371574 39 0.07581328 40 -0.60988734 41 -0.64153801 42 -0.66614805 43 -1.05421562 44 -1.23324303 45 -1.18006555 46 -0.79871867 47 -0.83249615 48 -1.27662247 49 -0.96804229 50 -0.71802957 51 -0.58151255 52 -0.55781145 53 -0.93639162 54 -0.81578819 55 -1.31210325 56 -1.59254120 57 -1.01368856 58 -0.90206163 59 -1.32238502 60 -1.26775124 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/15bd41257274751.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/21hoo1257274751.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/3ng7q1257274751.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/4lvj61257274751.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/5nc0k1257274751.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/6pu7a1257274751.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/76xtb1257274752.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/8eqf71257274752.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. -16.310 -7.322 -2.760 -1.435 4.372 16.500 > > #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/93mbw1257274752.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/10iy4m1257274752.tab") > > system("convert tmp/15bd41257274751.ps tmp/15bd41257274751.png") > system("convert tmp/21hoo1257274751.ps tmp/21hoo1257274751.png") > system("convert tmp/3ng7q1257274751.ps tmp/3ng7q1257274751.png") > system("convert tmp/4lvj61257274751.ps tmp/4lvj61257274751.png") > system("convert tmp/5nc0k1257274751.ps tmp/5nc0k1257274751.png") > system("convert tmp/6pu7a1257274751.ps tmp/6pu7a1257274751.png") > system("convert tmp/76xtb1257274752.ps tmp/76xtb1257274752.png") > system("convert tmp/8eqf71257274752.ps tmp/8eqf71257274752.png") > > > proc.time() user system elapsed 1.576 1.152 2.354