R version 2.8.1 (2008-12-22) Copyright (C) 2008 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(1.00,1.00,0.99,0.97,0.96,0.96,1.09,1.10,1.10,1.09,1.07,1.08,1.09,1.09,1.07,1.07,1.05,1.06,1.20,1.22,1.21,1.19,1.15,1.17,1.18,1.18,1.17,1.14,1.13,1.14,1.25,1.28,1.29,1.28,1.25,1.25,1.24,1.24,1.23,1.20,1.19,1.20,1.30,1.32,1.32,1.29,1.25,1.25,1.25,1.24,1.22,1.21,1.20,1.20,1.30,1.31,1.30,1.23,1.19,1.17) > x <- c(9487,8700,9627,8947,9283,8829,9947,9628,9318,9605,8640,9214,9567,8547,9185,9470,9123,9278,10170,9434,9655,9429,8739,9552,9687,9019,9672,9206,9069,9788,10312,10105,9863,9656,9295,9946,9701,9049,10190,9706,9765,9893,9994,10433,10073,10112,9266,9820,10097,9115,10411,9678,10408,10153,10368,10581,10597,10680,9738,9556) > 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.154389030 2 -0.059266708 3 -0.181310409 4 -0.119120855 5 -0.169732164 6 -0.114858550 7 -0.119987847 8 -0.071431276 9 -0.033962509 10 -0.078651335 11 0.017985312 12 -0.041392342 13 -0.074058390 14 0.049225942 15 -0.047887199 16 -0.082334292 17 -0.060393445 18 -0.069127829 19 -0.036941186 20 0.072016920 21 0.035305315 22 0.042621255 23 0.086019480 24 0.007754615 25 0.001437571 26 0.082176722 27 -0.006749424 28 0.019574594 29 0.026133372 30 -0.050769995 31 -0.004104299 32 0.050915169 33 0.090164981 34 0.105184448 35 0.118817432 36 0.040133020 37 0.059745433 38 0.138550712 39 -0.009358526 40 0.019141098 41 0.002009946 42 -0.003461029 43 0.084331405 44 0.051270795 45 0.094782912 46 0.060069100 47 0.122322575 48 0.055362261 49 0.021882105 50 0.130573491 51 -0.046070131 52 0.032525374 53 -0.065707530 54 -0.034886447 55 0.039127150 56 0.023382481 57 0.011448609 58 -0.068583352 59 0.005273355 60 0.007271147 > library(lattice) > postscript(file="/var/www/rcomp/tmp/11a4a1257355307.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/rcomp/tmp/21pjf1257355307.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/rcomp/tmp/3pgyi1257355307.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/rcomp/tmp/43d8s1257355307.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/rcomp/tmp/5yk5a1257355307.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/rcomp/tmp/6ovjj1257355307.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/rcomp/tmp/7zso61257355307.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/rcomp/tmp/8bh3a1257355307.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. 8547 9275 9656 9640 10010 10680 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9vi4l1257355307.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/rcomp/tmp/101cel1257355307.tab") > > system("convert tmp/11a4a1257355307.ps tmp/11a4a1257355307.png") > system("convert tmp/21pjf1257355307.ps tmp/21pjf1257355307.png") > system("convert tmp/3pgyi1257355307.ps tmp/3pgyi1257355307.png") > system("convert tmp/43d8s1257355307.ps tmp/43d8s1257355307.png") > system("convert tmp/5yk5a1257355307.ps tmp/5yk5a1257355307.png") > system("convert tmp/6ovjj1257355307.ps tmp/6ovjj1257355307.png") > system("convert tmp/7zso61257355307.ps tmp/7zso61257355307.png") > system("convert tmp/8bh3a1257355307.ps tmp/8bh3a1257355307.png") > > > proc.time() user system elapsed 2.010 1.770 3.491