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(59,42,54,63,57,65,70,44,67,62,54,49,48,40,39,47,50,54,40,47,51,44,37,30,40,39,44,38,46,50,37,34,58,43,40,44,32,38,49,46,35,38,48,35,37,34,57,49,30,37,36,36,49,40,47,46,32,37,37,35) > x <- c(369,380,474,413,537,439,355,473,435,478,450,365,315,340,326,483,406,409,423,404,551,467,332,442,305,368,411,318,398,586,367,383,533,527,418,576,359,342,456,406,374,568,335,458,456,386,457,396,366,499,354,365,594,456,366,398,468,609,418,352) > 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 15.5785789 2 -1.6861385 3 8.0517312 4 18.5197094 5 9.5356226 6 19.8940138 7 26.9154919 8 -1.9242035 9 21.9902747 10 15.9554704 11 8.6292964 12 5.6748398 13 5.8781005 14 -2.7235298 15 -3.3866168 16 0.8351443 17 5.6881659 18 9.6159703 19 -4.7209428 20 2.7362963 21 3.1987096 22 -1.7798122 23 -5.5310081 24 -15.1781819 25 -1.8812473 26 -4.3973559 27 -0.4321602 28 -4.1940951 29 1.8806876 30 1.3564271 31 -6.3732907 32 -9.7583341 33 10.6318835 34 -4.2237252 35 -4.6006167 36 -4.4029208 37 -11.1807689 38 -4.7716603 39 3.4849051 40 1.6881659 41 -8.5417472 42 -10.2103990 43 5.3967962 44 -10.5632253 45 -8.5150949 46 -9.8305298 47 11.4608399 48 4.9288181 49 -13.3492255 50 -9.5498992 51 -7.0604429 52 -7.3251602 53 0.1639053 54 -5.5150949 55 3.6507745 56 1.8806876 57 -13.8038775 58 -12.1970729 59 -7.6006167 60 -8.0123124 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ot601260021183.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/2ch521260021183.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/3zx101260021183.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/48wwh1260021183.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/5bwd01260021183.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/6hmfc1260021183.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/7tpj51260021183.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/8jyee1260021183.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. 305.0 366.0 410.0 424.9 467.2 609.0 > > #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/943qe1260021183.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/10mint1260021183.tab") > > system("convert tmp/1ot601260021183.ps tmp/1ot601260021183.png") > system("convert tmp/2ch521260021183.ps tmp/2ch521260021183.png") > system("convert tmp/3zx101260021183.ps tmp/3zx101260021183.png") > system("convert tmp/48wwh1260021183.ps tmp/48wwh1260021183.png") > system("convert tmp/5bwd01260021183.ps tmp/5bwd01260021183.png") > system("convert tmp/6hmfc1260021183.ps tmp/6hmfc1260021183.png") > system("convert tmp/7tpj51260021183.ps tmp/7tpj51260021183.png") > system("convert tmp/8jyee1260021183.ps tmp/8jyee1260021183.png") > > > proc.time() user system elapsed 1.641 1.217 2.017