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(5.2015218082,4.9781165096,4.1717377038,3.4185483008,3.3951430023,3.6483324052,3.7483324052,3.6483324052,3.3185483008,3.1185483008,3.3121694949,4.3185483008,4.5185483008,4.3951430023,3.7717377038,3.3717377038,3.4249271067,3.4781165096,3.4547112111,3.2547112111,3.0547112111,3.1249271067,3.2653588979,4.1589800920,4.4291959876,4.2057906890,3.6589800920,3.3355747935,3.3121694949,3.3887641964,3.4121694949,3.4589800920,3.5355747935,3.1823853905,2.7760065846,2.8057906890,2.5291959876,2.1760065846,2.3994118831,2.4228171817,2.4526012861,2.2823853905,1.9823853905,1.5760065846,1.3462224802,1.1164383758,1.4462224802,2.4887641964,2.9653588979,2.6589800920,2.4462224802,2.1164383758,2.3228171817,2.6121694949,2.5717377038,2.3249271067,1.8717377038,1.4419535993,1.5185483008,2.2015218082,2.5781165096) > x <- c(16.1387531550,14.1499707810,12.8051002773,12.2826650254,11.5938826513,11.1163179032,11.0163179032,11.1163179032,10.7826650254,10.4826650254,14.4377945217,14.4826650254,14.4826650254,13.7938826513,12.7051002773,12.3051002773,11.1275355291,10.6499707810,9.7611884069,9.5611884069,9.1611884069,9.4275355291,13.7602297736,14.8153592699,14.7817063921,13.0929240181,11.4153592699,10.2265768958,9.9377945217,9.6490121477,9.9377945217,11.4153592699,10.6265768958,10.0041416440,13.0592711403,12.1929240181,10.8817063921,10.0592711403,9.0480535144,9.2368358884,9.2704887662,8.4041416440,6.9041416440,6.2592711403,5.6256182625,7.7919653848,14.3256182625,14.9490121477,13.3602297736,11.0153592699,8.8256182625,9.7919653848,11.9368358884,12.5377945217,12.3051002773,11.2275355291,9.9051002773,10.6714473995,14.4826650254,14.5387531550,13.6499707810) > 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 1.21866052 2 1.39452404 3 0.85814203 4 0.20983696 5 0.32471191 6 0.67377743 7 0.79385347 8 0.67377743 9 0.41097762 10 0.27120575 11 -0.32920659 12 0.66816399 13 0.86816399 14 0.88303895 15 0.47821808 16 0.15852225 17 0.44812007 18 0.59718558 19 0.75221263 20 0.59236471 21 0.47266889 22 0.48941282 23 -0.23998899 24 0.44180394 25 0.71877600 26 0.83441140 27 0.62438944 28 0.53964461 29 0.57421539 30 0.70878617 31 0.67421539 32 0.42438944 33 0.65934044 34 0.43111141 35 -0.58861654 36 -0.38490421 37 -0.39825828 38 -0.58633522 39 -0.15991743 40 -0.17441216 41 -0.15138422 42 -0.14767189 43 -0.14653123 44 -0.42344555 45 -0.52601722 46 -1.19071813 47 -2.17263305 48 -1.25524417 49 -0.45968482 50 -0.29530639 51 -0.06845063 52 -0.59223901 53 -0.81646535 54 -0.64776176 55 -0.64147775 56 -0.67195597 57 -0.85965269 58 -1.44328898 59 -2.13183601 60 -1.46012278 61 -0.90509574 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1r7961257356439.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/2wdei1257356439.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/38esq1257356439.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/4dpmm1257356439.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/5btq01257356439.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/6e5bu1257356439.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/7zrxm1257356439.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/875e11257356439.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. 5.626 9.905 11.120 11.400 13.090 16.140 > > #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/9xu241257356439.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/10wgw81257356439.tab") > > system("convert tmp/1r7961257356439.ps tmp/1r7961257356439.png") > system("convert tmp/2wdei1257356439.ps tmp/2wdei1257356439.png") > system("convert tmp/38esq1257356439.ps tmp/38esq1257356439.png") > system("convert tmp/4dpmm1257356439.ps tmp/4dpmm1257356439.png") > system("convert tmp/5btq01257356439.ps tmp/5btq01257356439.png") > system("convert tmp/6e5bu1257356439.ps tmp/6e5bu1257356439.png") > system("convert tmp/7zrxm1257356439.ps tmp/7zrxm1257356439.png") > system("convert tmp/875e11257356439.ps tmp/875e11257356439.png") > > > proc.time() user system elapsed 1.639 1.217 5.941