R version 2.8.1 (2008-12-22) Copyright (C) 2008 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(91.4,91.1,104.4,97.6,93.7,104.5,95.4,86.5,102.9,101.9,103.7,100.7,94.2,93.6,104.7,101,97.6,105.8,93.7,91.2,106.3,103.4,107.4,101.2,96.9,96.3,109.8,97.9,105.1,107.9,95,95.2,105.8,110.1,112.2,102.5,103.7,102,112.3,103.3,106.9,104.6,100.7,99,106.5,114.9,114.1,102.2,107,107.4,107.4,110.1,105.6,110.9,101.9,93.2,110.5,113.1,101.7,96.7) > x <- c(97.33,97.89,98.69,99.01,99.18,98.45,98.13,98.29,99.1,99.26,98.85,98.05,98.53,99.34,100.14,100.3,100.22,99.9,99.58,99.9,100.78,100.78,100.46,100.06,100.28,100.78,101.58,102.06,102.02,101.68,101.32,101.81,102.3,102.12,102.1,101.75,101.5,102.16,103.47,104.05,104.09,103.55,102.77,102.89,103.6,103.76,103.92,103.35,103.32,104.2,105.44,105.81,106.25,105.94,105.82,105.96,106.49,106.32,105.88,105.07) > 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.98722910 2 -6.04217478 3 6.17933139 4 -1.05206615 5 -5.18124609 6 6.60287954 7 -2.06572293 8 -11.18142170 9 4.12660330 10 2.91090453 11 5.26363262 12 3.34212645 13 -3.80496985 14 -5.49694485 15 4.52456131 16 0.60886255 17 -2.68328807 18 5.94810946 19 -5.72049300 20 -8.65189054 21 5.26176625 22 2.36176625 23 6.79316378 24 1.13241070 25 -3.46417511 26 -4.73823375 27 7.68327241 28 -4.86382389 29 2.39010081 30 5.64846069 31 -6.76621709 32 -7.22679456 33 2.71262796 34 7.25528908 35 9.38225142 36 0.15409247 37 1.69112180 38 -0.89863561 39 7.63533073 40 -2.14657730 41 1.39949801 42 -0.17251865 43 -3.02098716 44 -4.88276124 45 1.66007549 46 9.84437672 47 8.82867795 48 -2.30289519 49 2.53754833 50 1.75120511 51 0.07953967 52 2.28073627 53 -2.81243534 54 2.90548102 55 -5.93274490 56 -14.82148132 57 1.76401651 58 4.59319645 59 -6.21363194 60 -10.12165693 > library(lattice) > postscript(file="/var/www/rcomp/tmp/11nsk1257271815.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/rcomp/tmp/2m6qx1257271815.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/rcomp/tmp/3anhs1257271815.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/rcomp/tmp/4vna11257271815.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/rcomp/tmp/57vp31257271815.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/rcomp/tmp/6wguf1257271815.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/rcomp/tmp/7qdpe1257271815.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/rcomp/tmp/83hz41257271815.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. 97.33 99.82 101.70 101.80 103.60 106.50 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/97pxa1257271815.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/rcomp/tmp/10h3l81257271815.tab") > > system("convert tmp/11nsk1257271815.ps tmp/11nsk1257271815.png") > system("convert tmp/2m6qx1257271815.ps tmp/2m6qx1257271815.png") > system("convert tmp/3anhs1257271815.ps tmp/3anhs1257271815.png") > system("convert tmp/4vna11257271815.ps tmp/4vna11257271815.png") > system("convert tmp/57vp31257271815.ps tmp/57vp31257271815.png") > system("convert tmp/6wguf1257271815.ps tmp/6wguf1257271815.png") > system("convert tmp/7qdpe1257271815.ps tmp/7qdpe1257271815.png") > system("convert tmp/83hz41257271815.ps tmp/83hz41257271815.png") > > > proc.time() user system elapsed 1.910 1.700 3.463