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(3922,3759,4138,4634,3996,4308,4143,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) > x <- c(2.092,2.041,2.015,2.028,2.054,2.054,2.054,2.015,2.015,1.960,2.015,2.015,2.028,2.041,2.041,2.067,2.092,2.104,2.104,2.104,2.067,1.988,1.932,1.887,1.902,1.932,1.946,1.960,1.974,1.960,1.932,1.946,1.917,1.856,1.902,1.887,1.856,1.841,1.825,1.872,1.917,1.917,1.856,1.808,1.758,1.808,1.974,1.988,1.932,1.808,1.758,1.825,1.960,2.041,2.067,2.041,2.001,2.015,2.079,2.092) > 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 -728.06483 2 -857.81498 3 -461.86407 4 25.66048 5 -629.29043 6 -317.29043 7 -482.29043 8 -170.86407 9 619.13593 10 364.99361 11 1155.13593 12 992.13593 13 -445.33952 14 345.18502 15 591.18502 16 121.23412 17 -159.06483 18 1074.11168 19 1073.11168 20 382.11168 21 1468.23412 22 321.73879 23 823.24843 24 1061.58653 25 92.80716 26 185.24843 27 456.12102 28 734.99361 29 -427.13380 30 60.99361 31 190.24843 32 -335.87898 33 580.02780 34 -291.20278 35 -405.19284 36 586.58653 37 -196.20278 38 91.57659 39 -666.99208 40 1019.36590 41 -288.97220 42 -705.97220 43 -102.20278 44 361.09120 45 -23.31091 46 104.09120 47 -467.13380 48 211.73879 49 -631.75157 50 -671.90880 51 -27.31091 52 -453.99208 53 -464.00639 54 171.18502 55 -1470.76588 56 -1031.81498 57 -687.73666 58 -421.86407 59 -778.58937 60 -463.06483 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ta211257184057.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/2vyme1257184057.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/3p12a1257184057.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/4a4201257184057.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/546ul1257184057.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/670021257184057.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/74qbb1257184057.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/8gm4y1257184057.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.758 1.902 1.974 1.966 2.041 2.104 > > #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/9nahy1257184057.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/10dpso1257184057.tab") > > system("convert tmp/1ta211257184057.ps tmp/1ta211257184057.png") > system("convert tmp/2vyme1257184057.ps tmp/2vyme1257184057.png") > system("convert tmp/3p12a1257184057.ps tmp/3p12a1257184057.png") > system("convert tmp/4a4201257184057.ps tmp/4a4201257184057.png") > system("convert tmp/546ul1257184057.ps tmp/546ul1257184057.png") > system("convert tmp/670021257184057.ps tmp/670021257184057.png") > system("convert tmp/74qbb1257184057.ps tmp/74qbb1257184057.png") > system("convert tmp/8gm4y1257184057.ps tmp/8gm4y1257184057.png") > > > proc.time() user system elapsed 1.656 1.233 2.525