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(3.253,3.233,3.196,3.138,3.091,3.17,3.378,3.468,3.33,3.413,3.356,3.525,3.633,3.597,3.6,3.522,3.503,3.532,3.686,3.748,3.672,3.843,3.905,3.999,4.07,4.084,4.042,3.951,3.933,3.958,4.147,4.221,4.058,4.057,4.089,4.268,4.309,4.303,4.177,4.117,4.065,3.983,4.091,4.067,4.024,3.868,3.8,3.804,3.862,3.792,3.674,3.56,3.489,3.412,3.674,3.672,3.463,3.429,3.4,3.533) > x <- c(519164,517009,509933,509127,500857,506971,569323,579714,577992,565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258) > 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.146842936 2 -0.151439758 3 -0.137863010 4 -0.190102007 5 -0.177990969 6 -0.142691681 7 -0.380361743 8 -0.364632939 9 -0.490324692 10 -0.317778975 11 -0.245263618 12 -0.129470700 13 -0.075342512 14 -0.100828324 15 -0.058359019 16 -0.052495681 17 -0.021912457 18 -0.036227195 19 -0.245384825 20 -0.306560219 21 -0.395783366 22 -0.215570049 23 -0.030937876 24 0.053863103 25 0.157663653 26 0.182285056 27 0.175673055 28 0.165641595 29 0.187982913 30 0.201746813 31 0.021163449 32 0.036917276 33 -0.121422458 34 -0.007238133 35 0.144220485 36 0.310805023 37 0.378487188 38 0.396331737 39 0.343759511 40 0.323743446 41 0.281964581 42 0.198770924 43 -0.026488100 44 -0.095103710 45 -0.095982629 46 -0.021177972 47 0.067233979 48 0.131760251 49 0.166158722 50 0.179943436 51 0.184747152 52 0.111874711 53 0.147238840 54 0.158698115 55 0.015426551 56 -0.052539079 57 -0.097614952 58 -0.027352230 59 0.066758835 60 0.168223418 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1mfhi1256731747.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/2aagg1256731747.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/325ms1256731747.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/4kibj1256731747.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/5q7mo1256731747.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/6py491256731747.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/7g5ko1256731747.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/8aew51256731747.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. 498700 542500 568200 566400 593400 628900 > > #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/9lczr1256731747.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/10q9d11256731748.tab") > > system("convert tmp/1mfhi1256731747.ps tmp/1mfhi1256731747.png") > system("convert tmp/2aagg1256731747.ps tmp/2aagg1256731747.png") > system("convert tmp/325ms1256731747.ps tmp/325ms1256731747.png") > system("convert tmp/4kibj1256731747.ps tmp/4kibj1256731747.png") > system("convert tmp/5q7mo1256731747.ps tmp/5q7mo1256731747.png") > system("convert tmp/6py491256731747.ps tmp/6py491256731747.png") > system("convert tmp/7g5ko1256731747.ps tmp/7g5ko1256731747.png") > system("convert tmp/8aew51256731747.ps tmp/8aew51256731747.png") > > > proc.time() user system elapsed 1.618 1.172 1.887