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.63,103.64,103.66,103.77,103.88,103.91,103.91,103.92,104.05,104.23,104.30,104.31,104.31,104.34,104.55,104.65,104.73,104.75,104.75,104.76,104.94,105.29,105.38,105.43,105.43,105.42,105.52,105.69,105.72,105.74,105.74,105.74,105.95,106.17,106.34,106.37,106.37,106.36,106.44,106.29,106.23,106.23,106.23,106.23,106.34,106.44,106.44,106.48,106.50,106.57,106.40,106.37,106.25,106.21,106.21,106.24,106.19,106.08,106.13,106.09) > x <- c(100.30,98.50,95.10,93.10,92.20,89.00,86.40,84.50,82.70,80.80,81.80,81.80,82.90,83.80,86.20,86.10,86.20,88.80,89.60,87.80,88.30,88.60,91.00,91.50,95.40,98.70,99.90,98.60,100.30,100.20,100.40,101.40,103.00,109.10,111.40,114.10,121.80,127.60,129.90,128.00,123.50,124.00,127.40,127.60,128.40,131.40,135.10,134.00,144.50,147.30,150.90,148.70,141.40,138.90,139.80,145.60,147.90,148.50,151.10,157.50) > 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 -1.4658724951 2 -1.3975492774 3 -1.2673831996 4 -1.0925796244 5 -0.9534180155 6 -0.8197322952 7 -0.7354876475 8 -0.6639242511 9 -0.4756010334 10 -0.2340376370 11 -0.1964394246 12 -0.1864394246 13 -0.2220813909 14 -0.2212429998 15 -0.0890072900 16 0.0142328888 17 0.0909927100 18 0.0267480623 19 0.0008266322 20 0.0691498499 21 0.2329489561 22 0.5732284198 23 0.5854641296 24 0.6192632358 25 0.4928962641 26 0.3759703651 27 0.4370882200 28 0.6492105438 29 0.6241275049 30 0.6473676837 31 0.6408873262 32 0.6084855386 33 0.7666426784 34 0.7889917741 35 0.8844676626 36 0.8269828361 37 0.5774890716 38 0.3795587036 39 0.3850345921 40 0.2965979886 41 0.3824060327 42 0.3662051389 43 0.2560390611 44 0.2495587036 45 0.3336372735 46 0.3364319107 47 0.2165452966 48 0.2921872630 49 -0.0280315067 50 -0.0487565120 51 -0.3354029474 52 -0.2941190146 53 -0.1775859652 54 -0.1365814962 55 -0.1657431051 56 -0.3236734731 57 -0.4481975846 58 -0.5776386571 59 -0.6118833049 60 -0.8592547455 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/16kq71256298993.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/2njtq1256298993.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/3io0t1256298993.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/41b331256298993.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/5bnf71256298993.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/6hv7f1256298993.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/74nu51256298993.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/8s3tf1256298993.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. 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/9wpl01256298993.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/103hnv1256298993.tab") > > system("convert tmp/16kq71256298993.ps tmp/16kq71256298993.png") > system("convert tmp/2njtq1256298993.ps tmp/2njtq1256298993.png") > system("convert tmp/3io0t1256298993.ps tmp/3io0t1256298993.png") > system("convert tmp/41b331256298993.ps tmp/41b331256298993.png") > system("convert tmp/5bnf71256298993.ps tmp/5bnf71256298993.png") > system("convert tmp/6hv7f1256298993.ps tmp/6hv7f1256298993.png") > system("convert tmp/74nu51256298993.ps tmp/74nu51256298993.png") > system("convert tmp/8s3tf1256298993.ps tmp/8s3tf1256298993.png") > > > proc.time() user system elapsed 1.596 1.128 2.396