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,91.74,84.40,84.40,87.16,88.07,87.16,83.49,81.65,82.57,92.66,94.50,93.58,88.07,84.40,85.32,86.24,86.24,84.40,82.57,82.57,82.57,89.91,91.74,89.91,85.32,82.57,82.57,83.49,83.49,83.49,84.40,80.73,76.15,77.06,74.31,70.64,72.48,72.48,73.39,72.48,69.72,65.14,62.39,59.63,63.30,75.23,79.82,76.15,72.48,68.81,71.56,76.15,77.06,75.23,70.64,66.06,66.97,74.31,77.98) > x <- c(100,95.06,92.59,93.83,96.30,96.30,96.30,92.59,92.59,87.65,92.59,92.59,93.83,95.06,95.06,97.53,100.00,101.23,101.23,101.23,97.53,90.12,85.19,81.48,82.72,85.19,86.42,87.65,88.89,87.65,85.19,86.42,83.95,79.01,82.72,81.48,79.01,77.78,76.54,80.25,83.95,83.95,79.01,75.31,71.60,75.31,88.89,90.12,85.19,75.31,71.60,76.54,87.65,95.06,97.53,95.06,91.36,92.59,98.77,100.00) > 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 13.08322413 2 7.88895706 3 2.08182352 4 1.31228732 5 2.53942085 6 3.44942085 7 2.53942085 8 1.17182352 9 -0.66817648 10 3.31755645 11 10.34182352 12 12.18182352 13 10.49228732 14 4.21895706 15 0.54895706 16 -0.06390941 17 -0.67677587 18 -1.44010614 19 -3.28010614 20 -5.11010614 21 -2.81390941 22 1.78468998 23 12.18421698 24 16.31661964 25 13.71708344 26 7.59421698 27 4.08088671 28 3.31755645 29 3.46802025 30 4.23755645 31 5.76421698 32 5.91088671 33 3.77375318 34 2.25948611 35 0.86708344 36 -1.11338036 37 -3.25051389 38 -0.64718363 39 0.12235257 40 -1.27005010 41 -4.47624682 42 -7.23624682 43 -8.75051389 44 -9.20431717 45 -9.66191450 46 -8.29431717 47 -4.79197975 48 -0.96531002 49 -1.57578302 50 0.88568283 51 -0.48191450 52 -0.79764743 53 -3.10244355 54 -6.79104294 55 -10.15390941 56 -13.21104294 57 -15.49484622 58 -15.34817648 59 -11.84344561 60 -8.93677587 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1di8i1257946887.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/223qe1257946887.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/37e2s1257946887.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/4q0qv1257946887.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/5pjvq1257946887.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/61apg1257946887.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/7oz191257946887.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/8hmfm1257946887.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. 71.60 82.72 88.89 88.56 95.06 101.20 > > #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/9uzqo1257946887.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/10ehjz1257946887.tab") > > system("convert tmp/1di8i1257946887.ps tmp/1di8i1257946887.png") > system("convert tmp/223qe1257946887.ps tmp/223qe1257946887.png") > system("convert tmp/37e2s1257946887.ps tmp/37e2s1257946887.png") > system("convert tmp/4q0qv1257946887.ps tmp/4q0qv1257946887.png") > system("convert tmp/5pjvq1257946887.ps tmp/5pjvq1257946887.png") > system("convert tmp/61apg1257946887.ps tmp/61apg1257946887.png") > system("convert tmp/7oz191257946887.ps tmp/7oz191257946887.png") > system("convert tmp/8hmfm1257946887.ps tmp/8hmfm1257946887.png") > > > proc.time() user system elapsed 1.587 1.232 1.990