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(25.6,23.7,22,21.3,20.7,20.4,20.3,20.4,19.8,19.5,23.1,23.5,23.5,22.9,21.9,21.5,20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.3,19.8,21.2,21.5,20.6,19.1,19.6,23.5,24) > x <- c(2.720294,2.664583,2.607681,2.626785,2.683282,2.720294,2.701851,2.626785,2.626785,2.607681,2.664583,2.683282,2.664583,2.645751,2.626785,2.664583,2.701851,2.738613,2.738613,2.738613,2.701851,2.645751,2.588436,2.54951,2.54951,2.54951,2.569047,2.607681,2.626785,2.626785,2.607681,2.607681,2.54951,2.469818,2.469818,2.428992,2.387467,2.428992,2.428992,2.469818,2.50998,2.48998,2.428992,2.387467,2.32379,2.366432,2.48998,2.50998,2.44949,2.366432,2.345208,2.428992,2.54951,2.607681,2.607681,2.54951,2.48998,2.48998,2.54951,2.588436) > 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 3.59390793 2 2.37851964 3 1.37776710 4 0.44300517 5 -0.85126540 6 -1.60609207 7 -1.47945292 8 -0.45699483 9 -1.05699483 10 -1.12223290 11 1.77851964 12 1.94873460 13 2.17851964 14 1.80993907 15 1.04300517 16 0.17851964 17 -1.27945292 18 -2.03120744 19 -2.83120744 20 -3.03120744 21 -2.97945292 22 -2.29006093 23 2.21426174 24 3.39260884 25 3.09260884 26 1.49260884 27 -0.24747407 28 -1.82223290 29 -2.25699483 30 -2.45699483 31 -2.02223290 32 -0.72223290 33 -0.70739116 34 -0.52808588 35 2.17191412 36 2.07360961 37 1.18389486 38 -0.32639039 39 -1.42639039 40 -1.82808588 41 -2.02162173 42 -2.37584918 43 -3.12639039 44 -3.61610514 45 -3.73360222 46 -2.35761387 47 2.92415082 48 4.27837827 49 3.52171733 50 1.84238613 51 -0.79680004 52 -1.12639039 53 -0.10739116 54 0.57776710 55 0.87776710 56 0.69260884 57 -0.07584918 58 0.42415082 59 3.59260884 60 3.61426174 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1t8pj1259340501.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/24n3y1259340501.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/31i0p1259340501.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/4plq41259340501.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/5hafw1259340501.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/6qgj51259340501.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/7by6e1259340501.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/81eqn1259340501.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.324 2.485 2.588 2.564 2.646 2.739 > > #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/976hr1259340501.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/10kzu61259340501.tab") > > system("convert tmp/1t8pj1259340501.ps tmp/1t8pj1259340501.png") > system("convert tmp/24n3y1259340501.ps tmp/24n3y1259340501.png") > system("convert tmp/31i0p1259340501.ps tmp/31i0p1259340501.png") > system("convert tmp/4plq41259340501.ps tmp/4plq41259340501.png") > system("convert tmp/5hafw1259340501.ps tmp/5hafw1259340501.png") > system("convert tmp/6qgj51259340501.ps tmp/6qgj51259340501.png") > system("convert tmp/7by6e1259340501.ps tmp/7by6e1259340501.png") > system("convert tmp/81eqn1259340501.ps tmp/81eqn1259340501.png") > > > proc.time() user system elapsed 1.623 1.194 2.099