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(36.68,36.7,36.71,36.72,36.73,36.73,36.87,37.31,37.39,37.42,37.51,37.67,37.67,37.71,37.78,37.79,37.84,37.88,38.34,38.58,38.72,38.83,38.9,38.92,38.94,39.1,39.14,39.16,39.32,39.34,39.44,39.92,40.19,40.2,40.27,40.28,40.3,40.34,40.4,40.43,40.48,40.48,40.63,40.74,40.77,40.91,40.92,41.03,41,41.04,41.33,41.44,41.46,41.55,41.55,41.81,41.78,41.84,41.84,41.86) > x <- c(5560,3922,3759,4138,4634,3996,4308,4429,5219,4929,5755,5592,4163,4962,5208,4755,4491,5732,5731,5040,6102,4904,5369,5578,4619,4731,5011,5299,4146,4625,4736,4219,5116,4205,4121,5103,4300,4578,3809,5526,4247,3830,4394,4826,4409,4569,4106,4794,3914,3793,4405,4022,4100,4788,3163,3585,3903,4178,3863,4187) > 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.72692714 2 -3.40442027 3 -3.56334052 4 -3.16057502 5 -2.63656001 6 -3.29773254 7 -2.83440052 8 -2.26900573 9 -1.37031246 10 -1.64084543 11 -0.69484463 12 -0.70376488 13 -2.18466700 14 -1.31664685 15 -0.99171199 16 -1.45116522 17 -1.67475385 18 -0.34868000 19 0.11028368 20 -0.36581385 21 0.87475862 22 -0.25675345 23 0.29513563 24 0.53172663 25 -0.44210482 26 -0.16603691 27 0.16413286 28 0.48259318 29 -0.55228445 30 -0.03588689 31 0.17914469 32 0.12336695 33 1.32294652 34 0.38885846 35 0.37180753 36 1.39947435 37 0.58730892 38 0.91540604 39 0.17847551 40 1.98783796 41 0.71238392 42 0.28023824 43 1.01472305 44 1.57241355 45 1.17026786 46 1.47607915 47 1.00626272 48 1.82925129 49 0.88728917 50 0.80189438 51 1.72612258 52 1.43921179 53 1.54004480 54 2.34303336 55 0.65901241 56 1.35633969 57 1.65588964 58 2.00087780 59 1.67443682 60 2.03020469 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/15pwf1260733361.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/2aib21260733361.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/3o3f21260733361.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/4wm9p1260733361.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/59fky1260733361.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/6h26r1260733361.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/7yde31260733361.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/8pl0o1260733361.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. 3163 4134 4530 4592 5018 6102 > > #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/9tazz1260733361.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/10idey1260733361.tab") > > try(system("convert tmp/15pwf1260733361.ps tmp/15pwf1260733361.png",intern=TRUE)) character(0) > try(system("convert tmp/2aib21260733361.ps tmp/2aib21260733361.png",intern=TRUE)) character(0) > try(system("convert tmp/3o3f21260733361.ps tmp/3o3f21260733361.png",intern=TRUE)) character(0) > try(system("convert tmp/4wm9p1260733361.ps tmp/4wm9p1260733361.png",intern=TRUE)) character(0) > try(system("convert tmp/59fky1260733361.ps tmp/59fky1260733361.png",intern=TRUE)) character(0) > try(system("convert tmp/6h26r1260733361.ps tmp/6h26r1260733361.png",intern=TRUE)) character(0) > try(system("convert tmp/7yde31260733361.ps tmp/7yde31260733361.png",intern=TRUE)) character(0) > try(system("convert tmp/8pl0o1260733361.ps tmp/8pl0o1260733361.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.561 1.171 1.964