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(107.3,107.2,107.2,105.7,105.7,104.9,104.8,104,104,103.6,103.6,103.6,103.6,104.2,104.2,104.7,104.7,104.7,106.1,106.1,106.1,106.1,106.1,106.1,106.1,106.1,106.1,106.1,106.1,106.1,106.1,106.1,106.1,106.2,106.4,106.4,106.4,107,107,107,107,106.1,106.3,106.2,106.2,106.3,106.3,106.2,107.1,105.2,103.4,102.4,100.6,100.6,100.6,99.8,100.2,101.4,101,100.6,100) > x <- c(73.2,50.3,47.1,49.2,45.1,39.2,34.7,35.7,36.4,44.6,37.6,43,45.9,39.3,42.3,42.8,36.5,41.8,35,36.7,41.2,41.4,34.2,42.2,48.2,38.6,41.6,45.9,41.5,45,38.1,47.4,41.3,46.6,39.7,44.2,52.4,55.1,48.9,45.3,58.2,52.4,42.6,44.6,53.4,53.8,56.2,53,63.1,45.9,46.6,59.8,67,56.2,59.1,58.4,52.7,69.1,69.3,58.6,80.8) > 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 4.60656022 2 2.48790735 3 2.20582485 4 0.89094149 5 0.52952329 6 -0.79056631 7 -1.28724482 8 -1.99909404 9 -1.93738850 10 -1.61455210 11 -2.23160756 12 -1.75559335 13 -1.49995609 14 -1.48175124 15 -1.21729889 16 -0.67322350 17 -1.22857342 18 -0.76137428 19 0.03920041 20 0.18905674 21 0.58573525 22 0.60336540 23 -0.03132021 24 0.67388603 25 1.20279071 26 0.35654322 27 0.62099556 28 1.00004391 29 0.61218048 30 0.92070821 31 0.31246783 32 1.13227009 33 0.59455033 34 1.16174946 35 0.75350908 36 1.15018759 37 1.87302399 38 2.71103109 39 2.16449626 40 1.84715345 41 2.98429851 42 1.57302399 43 0.90914634 44 0.98544790 45 1.76117477 46 1.89643508 47 2.10799695 48 1.72591445 49 3.51623734 50 0.10004391 51 -1.63825054 52 -1.47466024 53 -2.63997462 54 -3.59200305 55 -3.33636579 56 -4.19807133 57 -4.30053078 58 -1.65485798 59 -2.03722783 60 -3.38044118 61 -2.02349385 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ryjk1257351442.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/2606w1257351442.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/3aoaa1257351442.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/42jkx1257351442.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/58ciu1257351442.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/60obo1257351442.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/7hnj71257351442.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/8xuz41257351442.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. 34.20 41.40 45.90 48.13 53.40 80.80 > > #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/9axun1257351442.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/109e801257351442.tab") > > system("convert tmp/1ryjk1257351442.ps tmp/1ryjk1257351442.png") > system("convert tmp/2606w1257351442.ps tmp/2606w1257351442.png") > system("convert tmp/3aoaa1257351442.ps tmp/3aoaa1257351442.png") > system("convert tmp/42jkx1257351442.ps tmp/42jkx1257351442.png") > system("convert tmp/58ciu1257351442.ps tmp/58ciu1257351442.png") > system("convert tmp/60obo1257351442.ps tmp/60obo1257351442.png") > system("convert tmp/7hnj71257351442.ps tmp/7hnj71257351442.png") > system("convert tmp/8xuz41257351442.ps tmp/8xuz41257351442.png") > > > proc.time() user system elapsed 1.621 1.160 2.096