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(103.7,103.75,103.85,104.02,104.13,104.17,104.18,104.2,104.5,104.78,104.88,104.89,104.9,104.95,105.24,105.35,105.44,105.46,105.47,105.48,105.75,106.1,106.19,106.23,106.24,106.25,106.35,106.48,106.52,106.55,106.55,106.56,106.89,107.09,107.24,107.28,107.3,107.31,107.47,107.35,107.31,107.32,107.32,107.34,107.53,107.72,107.75,107.79,107.81,107.9,107.8,107.86,107.8,107.74,107.75,107.83,107.8,107.81,107.86,107.83) > x <- c(100.3,98.5,95.1,93.1,92.2,89,86.4,84.5,82.7,80.8,81.8,81.8,82.9,83.8,86.2,86.1,86.2,88.8,89.6,87.8,88.3,88.6,91,91.5,95.4,98.7,99.9,98.6,100.3,100.2,100.4,101.4,103,109.1,111.4,114.1,121.8,127.6,129.9,128,123.5,124,127.4,127.6,128.4,131.4,135.1,134,144.5,147.3,150.9,148.7,141.4,138.9,139.8,145.6,147.9,148.5,151.1,157.5) > par2 = '0' > 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 -2.140738785 2 -2.004010632 3 -1.740190787 4 -1.473826173 5 -1.320462096 6 -1.126278713 7 -0.991004714 8 -0.879458330 9 -0.492730177 10 -0.121183793 11 -0.069366101 12 -0.059366101 13 -0.102366639 14 -0.095730715 15 0.078631747 16 0.193449978 17 0.278631747 18 0.173357748 19 0.144811903 20 0.241540056 21 0.487448902 22 0.822994210 23 0.797356672 24 0.813265519 25 0.635354520 26 0.486352906 27 0.528534138 28 0.721171137 29 0.679261215 30 0.714079446 31 0.704442984 32 0.666260677 33 0.919168985 34 0.825256911 35 0.864437604 36 0.774345374 37 0.423341608 38 0.153884226 39 0.203064920 40 0.174611303 41 0.351431686 42 0.337340532 43 0.173520688 44 0.183884226 45 0.335338380 46 0.380791459 47 0.232516922 48 0.325517460 49 -0.160396767 50 -0.205307227 51 -0.478763533 52 -0.312762457 53 -0.021031614 54 0.039424154 55 0.006060078 56 -0.193397305 57 -0.334216611 58 -0.353125996 59 -0.428399995 60 -0.766766761 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/15mjo1292683332.ps",horizontal=F,onefile=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/25mjo1292683332.ps",horizontal=F,onefile=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/35mjo1292683332.ps",horizontal=F,onefile=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/45mjo1292683332.ps",horizontal=F,onefile=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/5xvj91292683332.ps",horizontal=F,onefile=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/6xvj91292683332.ps",horizontal=F,onefile=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/7qm0u1292683332.ps",horizontal=F,onefile=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/8qm0u1292683332.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + acf(mylm$resid,lag.max=par2,main='Residual Autocorrelation Function') + grid() + dev.off() + } > summary(x) Min. 1st Qu. Median Mean 3rd Qu. Max. 80.80 88.95 100.40 110.80 130.30 157.50 > > #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/9b5gh1292683332.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/10xnxn1292683332.tab") > > try(system("convert tmp/15mjo1292683332.ps tmp/15mjo1292683332.png",intern=TRUE)) character(0) > try(system("convert tmp/25mjo1292683332.ps tmp/25mjo1292683332.png",intern=TRUE)) character(0) > try(system("convert tmp/35mjo1292683332.ps tmp/35mjo1292683332.png",intern=TRUE)) character(0) > try(system("convert tmp/45mjo1292683332.ps tmp/45mjo1292683332.png",intern=TRUE)) character(0) > try(system("convert tmp/5xvj91292683332.ps tmp/5xvj91292683332.png",intern=TRUE)) character(0) > try(system("convert tmp/6xvj91292683332.ps tmp/6xvj91292683332.png",intern=TRUE)) character(0) > try(system("convert tmp/7qm0u1292683332.ps tmp/7qm0u1292683332.png",intern=TRUE)) character(0) > try(system("convert tmp/8qm0u1292683332.ps tmp/8qm0u1292683332.png",intern=TRUE)) convert: unable to open image `tmp/8qm0u1292683332.ps': No such file or directory. convert: missing an image filename `tmp/8qm0u1292683332.png'. character(0) > > > proc.time() user system elapsed 1.466 1.087 4.889