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(4.79,5.95,5.46,5.75,5.15,4.96,5.28,5.73,5.75,5.88,6.3,6.74,6.75,7.34,6.64,6.62,6.32,5.32,5.68,6.18,5.02,2.1,4,3,4.73,5.14,5.81,6.24,4.49,4.22,4.88,5.18,5.19,5.06,4.65,4.83,4.6,4.72,4.33,4.97,5.37,4.19,4.54,5.82,5.49,3.28,5.11,6.24,6.41,6.43,8.42,8.23,3.17,2.72,3,3.47,3.88,3.43,4.06) > x <- c(0.527,0.472,0.000,0.052,0.313,0.364,0.363,-0.155,0.052,0.568,0.668,1.378,0.252,-0.402,-0.050,0.555,0.050,0.150,0.450,0.299,0.199,0.496,0.444,-0.393,-0.444,0.198,0.494,0.133,0.388,0.484,0.278,0.369,0.165,0.155,0.087,0.414,0.360,0.975,0.270,0.359,0.169,0.381,0.154,0.486,0.925,0.728,-0.014,0.046,-0.819,-1.674,-0.788,0.279,0.396,-0.141,-0.019,0.099,0.742,0.005,0.448) > 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.21568888 2 0.91531915 3 0.17651536 4 0.49392594 5 0.03150601 6 -0.13161053 7 0.18786234 8 0.36481072 9 0.49392594 10 0.89592331 11 1.36863598 12 2.18289592 13 1.59935128 14 1.84461043 15 1.33015902 16 1.62907067 17 1.06287169 18 0.11558436 19 0.63372236 20 1.05412623 21 -0.15858643 22 -2.92202981 23 -1.04944040 24 -2.49064543 25 -0.78752889 26 -0.03911356 27 0.78691594 28 1.02662321 29 -0.58895949 30 -0.80835533 31 -0.25694343 32 0.09102510 33 -0.00650874 34 -0.14178001 35 -0.58762462 36 -0.23525420 37 -0.49371904 38 -0.04953613 39 -0.81116044 40 -0.12424616 41 0.17559977 42 -0.89264938 43 -0.66230713 44 0.79269892 45 0.69410754 46 -1.61973642 47 -0.18086442 48 0.98076318 49 0.69479861 50 0.26410529 51 2.72113953 52 3.09358370 53 -1.90474248 54 -2.63780950 55 -2.29350005 56 -1.76129910 57 -1.01235665 58 -1.85084901 59 -0.98733189 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1j8jk1257795629.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/27hyn1257795629.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/3vyqj1257795629.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/4hngc1257795629.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/5g2fy1257795629.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/60igp1257795629.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/7x0nr1257795629.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/8vmt01257795629.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.6740 0.0510 0.2780 0.2159 0.4490 1.3780 > > #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/965fc1257795629.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/10ci891257795629.tab") > > system("convert tmp/1j8jk1257795629.ps tmp/1j8jk1257795629.png") > system("convert tmp/27hyn1257795629.ps tmp/27hyn1257795629.png") > system("convert tmp/3vyqj1257795629.ps tmp/3vyqj1257795629.png") > system("convert tmp/4hngc1257795629.ps tmp/4hngc1257795629.png") > system("convert tmp/5g2fy1257795629.ps tmp/5g2fy1257795629.png") > system("convert tmp/60igp1257795629.ps tmp/60igp1257795629.png") > system("convert tmp/7x0nr1257795629.ps tmp/7x0nr1257795629.png") > system("convert tmp/8vmt01257795629.ps tmp/8vmt01257795629.png") > > > proc.time() user system elapsed 1.660 1.209 2.390