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(0.527,0.472,0.000,0.052,0.313,0.364,0.363,-0.155,0.052,0.568,0.668,1.378,0.252,-0.402,-0.050,0.555,0.050,0.150,0.450,0.299,0.199,0.496,0.444,-0.393,-0.444,0.198,0.494,0.133,0.388,0.484,0.278,0.369,0.165,0.155,0.087,0.414,0.360,0.975,0.270,0.359,0.169,0.381,0.154,0.486,0.925,0.728,-0.014,0.046,-0.819,-1.674,-0.788,0.279,0.396,-0.141,-0.019,0.099,0.742,0.005,0.448) > x <- c(24710.92,23983.59,24434.12,23939.23,24290.02,24117.63,23724.64,22989.44,23716.86,25058.83,25059.00,23579.18,24209.03,24173.67,24706.39,24522.12,24766.15,25940.04,24985.78,24788.00,26544.56,28019.08,27285.71,29161.16,28357.73,27979.91,27543.95,27397.53,27623.59,27736.07,27803.79,27779.55,27524.13,27582.72,28638.95,28825.78,30132.61,29326.85,29075.62,28230.63,28118.36,28173.29,27396.91,24578.55,24504.77,27582.37,26920.31,25426.68,25390.80,25041.16,22769.42,22921.89,26267.63,27364.67,28382.59,29132.81,28214.51,28865.73,24405.35) > 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.337341669 2 0.294364486 3 -0.185082807 4 -0.124902240 5 0.130299176 6 0.184148795 7 0.189644949 8 -0.316202142 9 -0.121226447 10 0.372590691 11 0.472587881 12 1.207049413 13 0.070637947 14 -0.582777550 15 -0.239583450 16 0.368462546 17 -0.140571287 18 -0.059975774 19 0.255798213 20 0.108067531 21 -0.020968533 22 0.251657544 23 0.211780204 24 -0.656221121 25 -0.693940365 26 -0.045694973 27 0.257511478 28 -0.101068189 29 0.150195023 30 0.244335720 31 0.037216304 32 0.128616993 33 -0.071160896 34 -0.082129393 35 -0.167588952 36 0.156322735 37 0.080720740 38 0.709040011 39 0.008192862 40 0.111160607 41 -0.076983561 42 0.134108442 43 -0.080057941 44 0.298529754 45 0.738749343 46 0.490876392 47 -0.240179708 48 -0.155489896 49 -1.019896797 50 -1.869117222 51 -0.945565196 52 0.118914464 53 0.180609140 54 -0.374525011 55 -0.269351302 56 -0.163752493 57 0.494427072 58 -0.253337642 59 0.263392763 > library(lattice) > postscript(file="/var/www/rcomp/tmp/12w251257796770.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/2f7s51257796770.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/30imo1257796771.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/47h2r1257796771.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/553j41257796771.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/6f17q1257796771.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/74vih1257796771.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/83j671257796771.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. 22770 24510 26540 26300 28000 30130 > > #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/984v81257796771.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/10spk91257796771.tab") > > system("convert tmp/12w251257796770.ps tmp/12w251257796770.png") > system("convert tmp/2f7s51257796770.ps tmp/2f7s51257796770.png") > system("convert tmp/30imo1257796771.ps tmp/30imo1257796771.png") > system("convert tmp/47h2r1257796771.ps tmp/47h2r1257796771.png") > system("convert tmp/553j41257796771.ps tmp/553j41257796771.png") > system("convert tmp/6f17q1257796771.ps tmp/6f17q1257796771.png") > system("convert tmp/74vih1257796771.ps tmp/74vih1257796771.png") > system("convert tmp/83j671257796771.ps tmp/83j671257796771.png") > > > proc.time() user system elapsed 2.120 1.800 3.765