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.079441542,2.091864062,2.041220329,2.014903021,2.028148247,2.054123734,2.054123734,2.054123734,2.014903021,2.014903021,1.960094784,2.014903021,2.014903021,2.028148247,2.041220329,2.041220329,2.066862759,2.091864062,2.104134154,2.104134154,2.104134154,2.066862759,1.987874348,1.931521412,1.887069649,1.902107526,1.931521412,1.945910149,1.960094784,1.974081026,1.960094784,1.931521412,1.945910149,1.916922612,1.85629799,1.902107526,1.887069649,1.85629799,1.840549633,1.824549292,1.871802177,1.916922612,1.916922612,1.85629799,1.808288771,1.757857918,1.808288771,1.974081026,1.987874348,1.931521412,1.808288771,1.757857918,1.824549292,1.960094784,2.041220329,2.066862759,2.041220329,2.00148,2.014903021,2.079441542,2.091864062) > x <- c(2.2300144,2.2300144,2.163323026,2.104134154,2.116255515,2.140066163,2.151762203,2.140066163,2.104134154,2.091864062,2.066862759,2.151762203,2.163323026,2.163323026,2.140066163,2.128231706,2.140066163,2.163323026,2.163323026,2.151762203,2.140066163,2.116255515,2.079441542,2.104134154,2.091864062,2.091864062,2.079441542,2.066862759,2.066862759,2.079441542,2.079441542,2.066862759,2.079441542,2.041220329,1.974081026,2.014903021,1.987874348,1.945910149,1.945910149,1.945910149,1.974081026,1.987874348,1.960094784,1.916922612,1.85629799,1.808288771,1.871802177,2.041220329,2.066862759,2.014903021,1.931521412,1.887069649,1.931521412,2.041220329,2.079441542,2.079441542,2.041220329,1.987874348,2.00148,2.091864062,2.116255515) > 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.0425915368 2 -0.0301690168 3 -0.0207860336 4 0.0061706189 5 0.0085058058 6 0.0130501103 7 0.0025228887 8 0.0130501103 9 0.0061706189 10 0.0172145259 11 -0.0150908591 12 -0.0366978243 13 -0.0471033416 14 -0.0338581156 15 0.0001467053 16 0.0107985115 17 0.0257891353 18 0.0298576994 19 0.0421277914 20 0.0525333087 21 0.0630605303 22 0.0472203178 23 0.0013669553 24 -0.0772109901 25 -0.1106188461 26 -0.0955809691 27 -0.0549859807 28 -0.0292754941 29 -0.0150908591 30 -0.0124263667 31 -0.0264126087 32 -0.0436642311 33 -0.0405972437 34 -0.0351831217 35 -0.0353778613 36 -0.0263108628 37 -0.0170211186 38 -0.0100221798 39 -0.0257705368 40 -0.0417708778 41 -0.0198736743 42 0.0128318444 43 0.0378353179 44 0.0160685505 45 0.0226255634 46 0.0154062323 47 0.0086707537 48 0.0219752923 49 0.0126887049 50 0.0031030232 51 -0.0450805691 52 -0.0555018496 53 -0.0288200481 54 0.0079890503 55 0.0547129363 56 0.0803553663 57 0.0891145953 58 0.0973892324 59 0.0985662527 60 0.0817530469 61 0.0722216208 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/10oa81257284373.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/2nwbm1257284373.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/3kvm51257284373.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/4qk511257284373.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/5urje1257284373.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/6w8zk1257284373.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/7bsdq1257284373.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/8zn1a1257284373.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. 1.808 1.988 2.079 2.059 2.128 2.230 > > #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/9jd5u1257284373.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/105gm91257284373.tab") > > system("convert tmp/10oa81257284373.ps tmp/10oa81257284373.png") > system("convert tmp/2nwbm1257284373.ps tmp/2nwbm1257284373.png") > system("convert tmp/3kvm51257284373.ps tmp/3kvm51257284373.png") > system("convert tmp/4qk511257284373.ps tmp/4qk511257284373.png") > system("convert tmp/5urje1257284373.ps tmp/5urje1257284373.png") > system("convert tmp/6w8zk1257284373.ps tmp/6w8zk1257284373.png") > system("convert tmp/7bsdq1257284373.ps tmp/7bsdq1257284373.png") > system("convert tmp/8zn1a1257284373.ps tmp/8zn1a1257284373.png") > > > proc.time() user system elapsed 1.566 1.157 1.947