R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(-13.65,-13.632,-12.474,-11.28,-10.606,-9.914,-9.668,-9.586,-9.968,-9.476,-9.63,-12.182,-12.51,-12.41,-11.818,-10.998,-10.47,-9.45,-9.104,-8.448,-8.284,-8.256,-8.856,-12.372,-13.246,-12.9,-11.388,-10.058,-9.056,-8.792,-8.728,-9.092,-10.058,-9.684,-9.428,-11.342,-10.95,-10.002,-9.282,-8.48,-8.262,-8.208,-7.716,-6.886,-6.366,-5.928,-7.186,-11.662,-12.874,-12.044,-10.63,-8.552,-8.726,-9.876,-10.424,-10.47,-9.932,-9.002,-9.312,-12.01,-12.32) > x <- c(-12.35,-12.432,-11.474,-10.58,-9.906,-9.214,-8.868,-8.886,-9.268,-8.876,-8.83,-11.082,-11.31,-11.31,-11.018,-10.298,-9.87,-8.85,-8.604,-8.048,-7.984,-7.856,-8.156,-11.072,-11.746,-11.5,-10.288,-9.158,-8.256,-7.992,-7.828,-8.092,-9.058,-8.784,-8.628,-10.542,-10.25,-9.402,-8.582,-7.68,-7.562,-7.708,-7.416,-6.486,-6.066,-5.628,-6.786,-11.162,-12.274,-11.444,-9.83,-7.752,-8.026,-9.276,-10.124,-10.37,-9.932,-9.102,-9.412,-11.91,-12.12) > 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.397828753 2 -0.291676579 3 -0.163551975 4 0.069374326 5 0.018806459 6 -0.033111885 7 -0.159071057 8 -0.057720580 9 -0.029060454 10 0.041529155 11 -0.161922065 12 -0.292962366 13 -0.375856322 14 -0.275856322 15 0.002235937 16 0.048216850 17 0.116105505 18 0.039578465 19 0.121121944 20 0.179407205 21 0.274605509 22 0.165002116 23 -0.112489932 24 -0.493712632 25 -0.643144764 26 -0.561601286 27 -0.352533415 28 -0.237313370 29 -0.204987281 30 -0.224794279 31 -0.337098627 32 -0.417291628 33 -0.344816021 34 -0.265373284 35 -0.177077420 36 -0.033476681 37 0.044615578 38 0.080993098 39 -0.080528639 40 -0.248202550 41 -0.157055678 42 0.053898192 43 0.231990452 44 0.062215798 45 0.130704664 46 0.097843054 47 0.084723751 48 0.313039754 49 0.296469232 50 0.234197230 51 -0.086895556 52 -0.242800641 53 -0.122243378 54 0.071539758 55 0.435162238 56 0.653618759 57 0.720757148 58 0.758485146 59 0.781743364 60 0.769159583 61 0.684915150 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1jhyt1257268060.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/freestat/rcomp/tmp/2j76b1257268060.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/freestat/rcomp/tmp/33d291257268060.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/freestat/rcomp/tmp/4qw9g1257268060.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/freestat/rcomp/tmp/5m7791257268060.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/freestat/rcomp/tmp/6dmmb1257268060.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/freestat/rcomp/tmp/7zl0d1257268060.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/freestat/rcomp/tmp/8o5v41257268060.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. -12.430 -10.580 -9.214 -9.415 -8.092 -5.628 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9el6l1257268060.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/freestat/rcomp/tmp/10eaay1257268060.tab") > > system("convert tmp/1jhyt1257268060.ps tmp/1jhyt1257268060.png") > system("convert tmp/2j76b1257268060.ps tmp/2j76b1257268060.png") > system("convert tmp/33d291257268060.ps tmp/33d291257268060.png") > system("convert tmp/4qw9g1257268060.ps tmp/4qw9g1257268060.png") > system("convert tmp/5m7791257268060.ps tmp/5m7791257268060.png") > system("convert tmp/6dmmb1257268060.ps tmp/6dmmb1257268060.png") > system("convert tmp/7zl0d1257268060.ps tmp/7zl0d1257268060.png") > system("convert tmp/8o5v41257268060.ps tmp/8o5v41257268060.png") > > > proc.time() user system elapsed 2.600 1.963 3.024