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.6112,0.5840,0.6842,-0.6891,-1.2026,-0.1637,0.8145,1.8764,2.3402,1.2938,0.2466,0.1588,0.1913,0.3426,0.5795,0.1044,-0.2742,0.4333,0.2669,1.0323,1.6045,0.7263,0.4351,0.2871,0.2614,0.3243,0.6935,-0.0753,0.2773,0.4574,0.1379,0.9182,1.2651,0.8310,0.3938,-0.0247,0.2290,0.2010,0.7199,0.3328,0.0547,-0.1410,-0.9896,-0.8393,-0.9211,-0.3444,-0.6909,-1.1006,-0.7894,-1.0100,-1.6239,-1.6399,-2.2518,-1.5901,-1.0551,-0.4071,-0.1571,-0.5985,-1.6240,-1.5202) > x <- c(0.8261,0.6698,0.5298,-0.3941,-0.8222,-0.3989,0.0482,0.6652,1.1634,0.6756,0.3273,0.3746,0.4142,0.4450,0.6470,0.3020,0.1949,0.1592,-0.2003,0.1388,0.6420,0.5751,0.6404,0.6916,0.8162,0.9539,1.2953,0.9542,0.8657,0.3737,-0.6978,-0.6497,-0.2217,0.0179,0.0356,-0.1155,0.0767,-0.0401,0.0712,-0.1210,-0.2479,-0.4653,-0.7343,-0.5642,-0.5734,-0.4474,-0.7552,-0.7610,-0.2143,-0.1667,-0.6350,-0.7647,-1.2518,-0.7948,-0.1537,0.0351,0.0250,-0.7998,-1.4750,-1.1927) > 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.28445903 2 -0.14218303 3 0.10981888 4 -0.26169690 5 -0.31100832 6 0.26890774 7 0.76231748 8 1.15520475 9 1.07880678 10 0.56132803 11 -0.10821049 12 -0.24729785 13 -0.25773610 14 -0.13983253 15 -0.12196101 16 -0.22297771 17 -0.48544925 18 0.26076024 19 0.48416588 20 0.88187995 21 0.90846049 22 0.10280012 23 -0.25920463 24 -0.46272076 25 -0.62352446 26 -0.70993249 27 -0.71091231 28 -1.10985778 29 -0.66129729 30 0.05227802 31 0.89460483 32 1.62275003 33 1.50556989 34 0.81167175 35 0.35527965 36 0.10061729 37 0.14591494 38 0.24456111 39 0.64277859 40 0.46408094 41 0.32357853 42 0.36360522 43 -0.19331824 44 -0.22745757 45 -0.29928201 46 0.14079626 47 0.12804362 48 -0.27536745 49 -0.55695393 50 -0.82916658 51 -0.93528917 52 -0.81065554 53 -0.89439330 54 -0.72821813 55 -0.88836247 56 -0.44507820 57 -0.18412678 58 0.26880337 59 -0.02457767 60 -0.22687539 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/17z061257347375.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/2b3o11257347375.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/3vmzd1257347375.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/4q3za1257347375.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/53b5y1257347375.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/6h59s1257347375.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/7ooox1257347375.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/89fbj1257347375.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. -1.47500 -0.49000 0.03005 -0.00013 0.54110 1.29500 > > #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/9y0411257347375.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/10zz541257347375.tab") > > system("convert tmp/17z061257347375.ps tmp/17z061257347375.png") > system("convert tmp/2b3o11257347375.ps tmp/2b3o11257347375.png") > system("convert tmp/3vmzd1257347375.ps tmp/3vmzd1257347375.png") > system("convert tmp/4q3za1257347375.ps tmp/4q3za1257347375.png") > system("convert tmp/53b5y1257347375.ps tmp/53b5y1257347375.png") > system("convert tmp/6h59s1257347375.ps tmp/6h59s1257347375.png") > system("convert tmp/7ooox1257347375.ps tmp/7ooox1257347375.png") > system("convert tmp/89fbj1257347375.ps tmp/89fbj1257347375.png") > > > proc.time() user system elapsed 1.656 1.223 2.426