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(100.00,96.67,91.06,89.04,82.91,84.05,91.76,90.10,85.98,99.82,70.90,83.87,99.21,92.81,95.35,89.66,86.77,88.26,101.23,88.26,96.32,100.44,74.85,88.08,100.61,102.10,98.95,89.40,92.90,92.29,104.12,92.99,95.79,102.72,81.07,91.32,98.60,107.27,99.30,87.64,97.02,98.86,96.23,102.80,95.62,101.58,84.14,87.47,102.37,101.40,87.12,82.65,79.75,81.68,90.36,82.47,80.46,90.01,72.39,78.09) > x <- c(100.00,111.86,94.12,67.79,146.04,125.66,142.87,130.03,110.01,132.79,88.24,91.97,96.65,97.15,90.73,52.53,156.91,144.88,169.43,133.38,131.28,116.33,89.15,85.08,89.39,103.09,85.35,45.99,152.82,130.37,150.50,126.97,123.24,126.57,100.26,91.76,100.28,121.65,97.29,62.55,154.99,147.85,147.40,156.80,126.81,131.76,99.21,87.35,100.76,110.57,76.46,56.51,124.95,118.29,136.43,128.62,100.74,111.75,93.43,83.33) > 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 9.48612983 2 5.04711758 3 1.09596053 4 1.53804253 5 -11.90900709 6 -8.86330139 7 -2.76258476 8 -3.22193406 9 -5.46989147 10 6.23998214 11 -18.51420878 12 -5.89299594 13 9.00938371 14 2.56262940 15 5.70295475 16 3.58498409 17 -9.06544581 18 -6.45053709 19 4.22382626 20 -5.37518795 21 2.88118016 22 8.39913405 23 -14.64930163 24 -1.03872154 25 11.08825631 26 11.29718819 27 9.80603114 28 3.93653047 29 -2.55299554 30 -1.06372700 31 8.88394446 32 -0.04579768 33 3.10298947 34 9.72160577 35 -9.46818241 36 1.57664087 37 8.05994742 38 14.73166818 39 9.03953820 40 0.62802770 41 1.36409075 42 3.87174230 43 1.28382118 44 6.97484014 45 2.59916370 46 8.09629602 47 -6.29999836 48 -1.86098611 49 11.78506328 50 9.89774371 51 -1.19267722 52 -3.79718023 53 -13.09691027 54 -10.54414285 55 -3.56038924 56 -10.72008691 57 -10.12306655 58 -1.60259647 59 -17.50951852 60 -10.86508145 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1n2m01260969505.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/23vrj1260969505.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/3asjc1260969505.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/4i8z71260969505.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/57dpk1260969505.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/60swm1260969505.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/7wogl1260969505.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/8r2di1260969505.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. 45.99 91.92 111.20 111.80 131.40 169.40 > > #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/925ip1260969505.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/10vow81260969505.tab") > > try(system("convert tmp/1n2m01260969505.ps tmp/1n2m01260969505.png",intern=TRUE)) character(0) > try(system("convert tmp/23vrj1260969505.ps tmp/23vrj1260969505.png",intern=TRUE)) character(0) > try(system("convert tmp/3asjc1260969505.ps tmp/3asjc1260969505.png",intern=TRUE)) character(0) > try(system("convert tmp/4i8z71260969505.ps tmp/4i8z71260969505.png",intern=TRUE)) character(0) > try(system("convert tmp/57dpk1260969505.ps tmp/57dpk1260969505.png",intern=TRUE)) character(0) > try(system("convert tmp/60swm1260969505.ps tmp/60swm1260969505.png",intern=TRUE)) character(0) > try(system("convert tmp/7wogl1260969505.ps tmp/7wogl1260969505.png",intern=TRUE)) character(0) > try(system("convert tmp/8r2di1260969505.ps tmp/8r2di1260969505.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.614 1.184 2.357