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(-6.24,-4.68,10.70,0.96,-4.25,9.83,-14.13,-4.49,12.82,8.93,2.27,-0.07,-7.56,-6.49,1.86,0.17,-4.20,11.65,-21.36,-6.71,10.77,3.41,6.18,-0.74,-4.70,-3.27,11.52,-3.99,4.28,9.57,-20.17,-4.97,9.48,10.75,6.95,-4.23,-0.27,-1.27,11.81,-1.48,1.61,9.77,-15.08,-2.89,5.08,14.61,5.71,-7.58,1.35,2.43,-1.25,6.22,-1.98,4.49,-15.42,-10.25,7.98,9.70,-5.40,-9.89) > x <- c(2.26,1.54,14.64,8.17,3.20,4.47,-2.74,-4.34,19.08,19.20,12.03,-3.34,-3.50,-3.79,-0.85,-3.00,-5.80,6.21,-20.01,-14.64,3.02,1.20,1.31,-5.49,-3.80,-9.18,3.91,-6.01,-4.91,4.36,-18.80,-13.29,5.83,7.11,1.18,-8.31,1.39,-2.15,9.66,-2.52,-3.05,2.31,-17.62,-10.77,4.54,14.93,-0.03,-12.31,1.09,0.51,5.56,9.18,5.38,11.08,-6.34,-7.50,9.24,12.07,-2.87,-12.65) > 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 -8.32429551 2 -6.21116354 3 -0.89509240 4 -5.66458708 5 -7.05644002 6 6.04789664 7 -12.37310129 8 -1.50391914 9 -2.18607286 10 -6.16826152 11 -7.31998901 12 2.14784201 13 -5.21923977 14 -3.92645051 15 2.16492729 16 2.12664081 17 -0.09229043 18 6.53116106 19 -6.33561646 20 4.18894095 21 8.10184297 22 2.14003766 23 4.82553139 24 3.12955553 25 -2.12876812 26 3.43435686 27 8.16811040 28 0.27903973 29 7.70397700 30 5.87240292 31 -6.07518546 32 4.89181851 33 4.65309182 34 4.93974610 35 5.69540244 36 1.80598907 37 -1.68592772 38 0.03363779 39 4.04073705 40 0.10788616 41 3.60505275 42 7.64729255 43 -1.89170730 44 5.03585662 45 1.24411993 46 2.79211834 47 5.38497144 48 1.52894444 49 0.16454394 50 1.69012247 51 -5.86948369 52 -1.18050831 53 -6.46120070 54 -4.37016211 55 -10.89744145 56 -4.83628440 57 0.53339736 58 0.07928143 59 -3.54323024 60 -0.51985435 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1cycg1261499100.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/2p1do1261499100.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/3v4431261499100.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/4mkkg1261499100.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/5ko331261499100.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/6j9j41261499100.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/7zk3f1261499100.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/8jzre1261499100.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. -20.01000 -5.05500 0.80000 -0.06583 5.42500 19.20000 > > #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/9evc31261499100.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/10ikhi1261499100.tab") > > try(system("convert tmp/1cycg1261499100.ps tmp/1cycg1261499100.png",intern=TRUE)) character(0) > try(system("convert tmp/2p1do1261499100.ps tmp/2p1do1261499100.png",intern=TRUE)) character(0) > try(system("convert tmp/3v4431261499100.ps tmp/3v4431261499100.png",intern=TRUE)) character(0) > try(system("convert tmp/4mkkg1261499100.ps tmp/4mkkg1261499100.png",intern=TRUE)) character(0) > try(system("convert tmp/5ko331261499100.ps tmp/5ko331261499100.png",intern=TRUE)) character(0) > try(system("convert tmp/6j9j41261499100.ps tmp/6j9j41261499100.png",intern=TRUE)) character(0) > try(system("convert tmp/7zk3f1261499100.ps tmp/7zk3f1261499100.png",intern=TRUE)) character(0) > try(system("convert tmp/8jzre1261499100.ps tmp/8jzre1261499100.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.649 1.230 10.529