R version 2.8.0 (2008-10-20) 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(0.70,0.71,0.71,0.73,0.76,0.77,0.78,0.76,0.74,0.79,0.75,0.70,0.67,0.63,0.64,0.64,0.63,0.64,0.68,0.68,0.69,0.68,0.70,0.72,0.73,0.73,0.75,0.74,0.74,0.76,0.76,0.77,0.76,0.78,0.79,0.79,0.78,0.79,0.79,0.78,0.81,0.83,0.84,0.83,0.84,0.85,0.83,0.82,0.81,0.83,0.82,0.79,0.77,0.76,0.77,0.76,0.75,0.77,0.80,0.82) > x <- c(181.10,191.20,206.20,212.00,224.70,231.30,229.30,227.40,253.90,265.90,277.70,292.10,282.90,292.80,311.00,330.90,350.00,348.50,360.90,345.90,308.80,320.00,322.00,322.90,343.30,354.70,376.60,383.20,392.50,388.20,407.40,412.50,419.80,418.10,389.20,391.60,412.90,385.90,385.50,350.20,336.30,318.50,345.40,377.40,359.50,315.60,307.80,277.40,186.90,160.00,149.10,148.90,137.90,134.00,157.50,175.10,181.00,182.20,207.80,219.40) > 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 -0.0604230779 2 -0.0498432240 3 -0.0489820549 4 -0.0286490695 5 0.0020800538 6 0.0124589682 7 0.0223441456 8 0.0022350642 9 -0.0162435370 10 0.0344453983 11 -0.0048771486 12 -0.0540504262 13 -0.0845786100 14 -0.1240102383 15 -0.1129653531 16 -0.1118228687 17 -0.1207263134 18 -0.1108124303 19 -0.0701005304 20 -0.0709616996 21 -0.0630916579 22 -0.0724486516 23 -0.0523338291 24 -0.0322821589 25 -0.0211109689 26 -0.0204564804 27 0.0008008266 28 -0.0088202590 29 -0.0082863341 30 0.0114667974 31 0.0125690939 32 0.0228618914 33 0.0132809937 34 0.0331833946 35 0.0415242087 36 0.0416619957 37 0.0328848559 38 0.0413347515 39 0.0413117870 40 0.0292851689 41 0.0584871522 42 0.0774652315 43 0.0890095948 44 0.0808467556 45 0.0898190938 46 0.0972987388 47 0.0768509308 48 0.0651056280 49 0.0499099075 50 0.0683655442 51 0.0577397613 52 0.0277282790 53 0.0070967550 54 -0.0031271490 55 0.0082220160 56 -0.0007675455 57 -0.0104288190 58 0.0096400745 59 0.0411098032 60 0.0617757740 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1bwre1257618436.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/freestat/rcomp/tmp/2yn481257618436.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/freestat/rcomp/tmp/3xh2f1257618436.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/freestat/rcomp/tmp/4y99d1257618436.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/freestat/rcomp/tmp/5ig5b1257618436.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/freestat/rcomp/tmp/6h51w1257618436.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/freestat/rcomp/tmp/7hqiq1257618436.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/freestat/rcomp/tmp/834e11257618436.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. 134.0 217.6 313.3 293.0 359.8 419.8 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9btmv1257618436.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/freestat/rcomp/tmp/10m6qz1257618436.tab") > > system("convert tmp/1bwre1257618436.ps tmp/1bwre1257618436.png") > system("convert tmp/2yn481257618436.ps tmp/2yn481257618436.png") > system("convert tmp/3xh2f1257618436.ps tmp/3xh2f1257618436.png") > system("convert tmp/4y99d1257618436.ps tmp/4y99d1257618436.png") > system("convert tmp/5ig5b1257618436.ps tmp/5ig5b1257618436.png") > system("convert tmp/6h51w1257618436.ps tmp/6h51w1257618436.png") > system("convert tmp/7hqiq1257618436.ps tmp/7hqiq1257618436.png") > system("convert tmp/834e11257618436.ps tmp/834e11257618436.png") > > > proc.time() user system elapsed 2.592 1.956 2.989