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(2.2,2.3,2.2,2,2.9,2.5,2.1,2.2,2.5,3,2.6,2.5,2.9,2.9,3.1,3.2,2.4,2.5,3,3,3,2.4,2.8,3,2.7,2.6,2.5,2.1,1.9,2.2,2.3,1.9,2,2,2,1.5,1.5,1.5,1.4,1.6,2.4,3.1,3.3,3.7,3.8,4.6,4.3,5.3,6,6.1,5.6,5.7,5,3.4,2.9,2.3,2.1,0.8,0.9,0) > x <- c(125.9,133.1,147,145.8,164.4,149.8,137.7,151.7,156.8,180,180.4,170.4,191.6,199.5,218.2,217.5,205,194,199.3,219.3,211.1,215.2,240.2,242.2,240.7,255.4,253,218.2,203.7,205.6,215.6,188.5,202.9,214,230.3,230,241,259.6,247.8,270.3,289.7,322.7,315,320.2,329.5,360.6,382.2,435.4,464,468.8,403,351.6,252,188,146.5,152.9,148.1,165.1,177,206.1) > 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.61414783 2 0.63418162 3 0.37980240 4 0.19313010 5 0.88655072 6 0.64870443 7 0.38309209 8 0.32760223 9 0.57095950 10 0.81329059 11 0.40884802 12 0.41991221 13 0.58445613 14 0.49671543 15 0.48902540 16 0.59679990 17 -0.06436987 18 0.15780073 19 0.59893671 20 0.37680834 21 0.46788097 22 -0.17765534 23 -0.05531580 24 0.12247136 25 -0.16086901 26 -0.42413337 27 -0.49747796 28 -0.51097460 29 -0.54993153 30 -0.27103372 31 -0.28209791 32 -0.38111397 33 -0.44104639 34 -0.56432764 35 -0.74536226 36 -1.24203034 37 -1.36420094 38 -1.57078032 39 -1.53972459 40 -1.58961900 41 -1.00508352 42 -0.67159533 43 -0.38607591 44 -0.04382928 45 -0.04711898 46 0.40747141 47 -0.13242723 48 0.27671131 49 0.65906774 50 0.70575693 51 0.93655926 52 1.60742918 53 2.01362846 54 1.12443924 55 1.08535561 56 0.41427453 57 0.26758534 58 -1.22122378 59 -1.25339016 60 -2.47658693 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1qev91256751207.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/2j9de1256751207.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/3xm111256751207.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/45rmq1256751207.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/5nimu1256751207.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/670071256751207.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/7cnhi1256751207.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/8rn751256751207.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. 125.9 179.2 214.6 232.5 253.6 468.8 > > #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/9n8731256751207.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/10s2351256751207.tab") > > system("convert tmp/1qev91256751207.ps tmp/1qev91256751207.png") > system("convert tmp/2j9de1256751207.ps tmp/2j9de1256751207.png") > system("convert tmp/3xm111256751207.ps tmp/3xm111256751207.png") > system("convert tmp/45rmq1256751207.ps tmp/45rmq1256751207.png") > system("convert tmp/5nimu1256751207.ps tmp/5nimu1256751207.png") > system("convert tmp/670071256751207.ps tmp/670071256751207.png") > system("convert tmp/7cnhi1256751207.ps tmp/7cnhi1256751207.png") > system("convert tmp/8rn751256751207.ps tmp/8rn751256751207.png") > > > proc.time() user system elapsed 1.583 1.194 1.985