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(26.35404199,8.085095727,-7.521619976,-6.126795599,-21.64657344,-11.37621019,-1.961731053,-11.93468212,-15.31268572,-24.17929035,-29.24423181,-21.72069533,-33.86259266,-33.99518648,-51.38119969,-49.91755214,-41.33813154,-38.65224142,-36.96271575,-47.0097887,-34.27848879,-35.69413875,-48.75297994,-41.07768723,-43.08415676,-47.12075538,-54.03110663,-25.58119969,3.422928203,13.26445627,11.2409198,29.99070365,25.55281112,17.60068563,-3.895678825,-0.996972731,4.217137145,-15.2026407,-0.486867659,11.41017527,2.460514505,-18.79715587,15.10296722,26.25872825,49.79883933,51.09964089,46.8928021,5.755588042,4.912273719,-17.36702379,-3.184153774,20.06082372,28.13124702,50.92188047,72.90955685,84.1704935,77.24979101,69.189779,60.70777059,56.93327945) > x <- c(0.614147829,0.634181616,0.379802399,0.193130101,0.886550717,0.648704427,0.383092091,0.327602232,0.570959498,0.813290589,0.408848021,0.419912206,0.584456134,0.496715428,0.489025402,0.596799895,-0.064369874,0.15780073,0.598936712,0.376808342,0.467880973,-0.177655342,-0.055315805,0.122471358,-0.160869014,-0.424133366,-0.497477961,-0.510974598,-0.54993153,-0.271033725,-0.28209791,-0.381113969,-0.441046395,-0.56432764,-0.745362262,-1.242030336,-1.36420094,-1.570780324,-1.539724585,-1.589619001,-1.00508352,-0.67159533,-0.386075908,-0.043829284,-0.047118976,0.407471409,-0.132427231,0.276711305,0.659067736,0.705756928,0.936559264,1.607429175,2.013628457,1.124439241,1.085355608,0.41427453,0.267585339,-1.221223776,-1.253390156,-2.476586934) > 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 29.2779401 2 11.1043727 3 -5.7134177 4 -5.2073220 5 -17.4257917 6 -8.2877915 7 -0.1378669 8 -10.3749998 9 -12.5944031 10 -20.3072929 11 -27.2977461 12 -19.7215342 13 -31.0800538 14 -31.6303726 15 -49.0529973 16 -47.0762459 17 -41.6445903 18 -37.9009675 19 -34.1112363 20 -45.2158408 21 -32.0509530 22 -36.5399386 23 -49.0163331 24 -40.4946130 25 -43.8500385 26 -49.1400131 27 -56.3995508 28 -28.0139001 29 0.8047577 30 11.9740911 31 9.8978791 32 28.1762571 33 23.4530321 34 14.9139766 35 -7.4442761 36 -6.9101584 37 -2.2776909 38 -22.6809731 39 -7.8173467 40 3.8421538 41 -2.3245904 42 -21.9945559 43 13.2648974 44 26.0500613 45 49.5745105 46 53.0395726 47 46.2623289 48 7.0729837 49 8.0500311 50 -14.0069837 51 1.2747138 52 27.7136377 53 37.7179363 54 56.2752263 55 78.0768294 56 86.1428143 57 78.5237388 58 63.3756514 59 54.7405019 60 45.1424899 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1k89p1256752183.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/2z4fw1256752183.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/3ouam1256752183.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/4vril1256752183.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/5g60x1256752183.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/6dd6o1256752183.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/7p2qi1256752183.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/8pmew1256752183.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. -2.477e+00 -4.552e-01 1.755e-01 -8.937e-18 5.743e-01 2.014e+00 > > #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/91emc1256752183.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/108f7o1256752183.tab") > > system("convert tmp/1k89p1256752183.ps tmp/1k89p1256752183.png") > system("convert tmp/2z4fw1256752183.ps tmp/2z4fw1256752183.png") > system("convert tmp/3ouam1256752183.ps tmp/3ouam1256752183.png") > system("convert tmp/4vril1256752183.ps tmp/4vril1256752183.png") > system("convert tmp/5g60x1256752183.ps tmp/5g60x1256752183.png") > system("convert tmp/6dd6o1256752183.ps tmp/6dd6o1256752183.png") > system("convert tmp/7p2qi1256752183.ps tmp/7p2qi1256752183.png") > system("convert tmp/8pmew1256752183.ps tmp/8pmew1256752183.png") > > > proc.time() user system elapsed 1.611 1.194 2.891