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.33,101.77,103,104.99,104.92,106,107.77,108.29,109.68,109.41,107.26,106.78,106.34,106.35,106.61,108.03,108.5,108.49,109.09,109.21,107.2,106.15,106.25,106.52,105.16,105.68,107.01,107.9,108.12,108.43,109.02,108.39,108.65,109.55,111.69,110.76,110.78,110.76,112.38,112.86,114.74,116.21,116.86,114.51,114.11,112.12,108.9,106.62,105.95,107.03,107.1,108,108.24,109.72,109.53,110.64) > x <- c(8.50,8.60,8.50,8.20,8.10,7.90,8.60,8.70,8.70,8.50,8.40,8.50,8.70,8.70,8.60,8.50,8.30,8.00,8.20,8.10,8.10,8.00,7.90,7.90,8.00,8.00,7.90,8.00,7.70,7.20,7.50,7.30,7.00,7.00,7.00,7.20,7.30,7.10,6.80,6.40,6.10,6.50,7.70,7.90,7.50,6.90,6.60,6.90,7.70,8.00,8.00,7.70,7.30,7.40,8.10,8.30) > 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 -6.18467197 2 -4.46442481 3 -3.51467197 4 -2.36541345 5 -2.71566061 6 -2.19615493 7 1.53557519 8 2.33582235 9 3.72582235 10 2.89532803 11 0.46508087 12 0.26532803 13 0.38582235 14 0.39582235 15 0.37557519 16 1.51532803 17 1.42483371 18 0.57409223 19 1.73458655 20 1.57433939 21 -0.43566061 22 -1.76590777 23 -1.94615493 24 -1.67615493 25 -2.75590777 26 -2.23590777 27 -1.18615493 28 -0.01590777 29 -0.63664925 30 -1.72788505 31 -0.29714357 32 -1.48763789 33 -2.06837937 34 -1.16837937 35 0.97162063 36 0.60211495 37 0.90236211 38 0.32186779 39 1.10112631 40 0.46013767 41 1.49939619 42 4.09038483 43 8.10335075 44 6.31384507 45 4.79285643 46 1.12137347 47 -2.93936801 48 -4.37862653 49 -2.80664925 50 -0.88590777 51 -0.81590777 52 -0.75664925 53 -1.63763789 54 0.12260927 55 1.89433939 56 3.56483371 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/10wsf1256691430.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/2k4cp1256691430.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/3ya7c1256691430.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/4ith51256691430.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/56bil1256691430.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/6ohmm1256691430.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/737mt1256691430.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/85hs81256691430.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. 6.100 7.300 7.950 7.789 8.300 8.700 > > #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/9o1x61256691430.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/10yq3u1256691430.tab") > > system("convert tmp/10wsf1256691430.ps tmp/10wsf1256691430.png") > system("convert tmp/2k4cp1256691430.ps tmp/2k4cp1256691430.png") > system("convert tmp/3ya7c1256691430.ps tmp/3ya7c1256691430.png") > system("convert tmp/4ith51256691430.ps tmp/4ith51256691430.png") > system("convert tmp/56bil1256691430.ps tmp/56bil1256691430.png") > system("convert tmp/6ohmm1256691430.ps tmp/6ohmm1256691430.png") > system("convert tmp/737mt1256691430.ps tmp/737mt1256691430.png") > system("convert tmp/85hs81256691430.ps tmp/85hs81256691430.png") > > > proc.time() user system elapsed 1.545 1.114 2.678