R version 2.8.0 (2008-10-20) 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(-657.60,-820.59,-441.59,54.41,-583.60,-271.60,-436.60,-150.60,639.40,349.40,1175.40,1012.40,-416.59,382.42,628.44,177.44,-88.55,1152.46,1151.48,460.48,1522.49,324.51,789.51,998.53,39.54,151.56,431.57,719.58,-433.41,45.59,156.60,-360.39,536.62,-374.37,-458.35,523.68,-279.32,-1.32,-770.31,946.67,-332.35,-749.35,-185.32,246.69,-170.31,-10.29,-473.30,214.70,-665.26,-786.45,-17453,-557.57,-479.61,208.35,-141.68,-994.71,-676.72,-401.72,-716.72,-392.72) > x <- c(-4509.6,-4514.6,-4504.6,-4534.6,-4266.6,-4477.6,-4529.6,-4349.6,-4432.6,-4476.6,-4420.6,-4505.6,-4521.6,-4507.6,-4521.6,-4480.6,-4533.6,-4509.5,-4506.5,-4497.5,-4404.5,-4496.5,-4444.5,-4440.5,-4412.5,-4527.4,-4513.4,-4450.4,-4501.4,-4483.4,-4449.4,-4520.4,-4504.4,-4486.4,-4428.3,-4463.3,-4499.3,-4470.3,-4416.3,-4510.3,-4473.4,-4510.3,-4450.3,-4489.3,-4438.3,-4457.3,-4468.3,-4352.3,-4501.3,-4503.4,-4491.5,-4530.6,-4410.6,-4506.6,-4483.7,-4444.7,-4422.7,-4505.7,-4475.7,-4370.7) > 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 -306.22114 2 -459.52146 3 -99.90082 4 454.23726 5 -703.13960 6 17.76491 7 -46.46242 8 -109.29091 9 841.55779 10 636.82697 11 1354.30255 12 1356.02712 13 -41.95591 14 729.92299 15 1003.07409 16 472.61872 17 309.33933 18 1503.64507 19 1496.85126 20 788.40984 21 1670.19178 22 650.50190 23 1014.72922 24 1215.99748 25 202.74527 26 537.43412 27 790.31302 28 956.23305 29 -97.92221 30 346.19494 31 391.31511 32 11.91857 33 877.92159 34 -67.95125 35 -264.52534 36 785.33242 37 52.09812 38 273.89798 39 -599.74057 40 1299.40542 41 -51.12442 42 -396.61458 43 51.13925 44 558.72876 45 42.89402 46 239.73481 47 -201.95790 48 261.24152 49 -329.96601 50 -447.08634 51 -17136.69778 52 -165.49448 53 -320.08681 54 553.91505 55 159.50632 56 -769.10319 57 -493.74778 58 -57.89909 59 -431.03717 60 -310.52046 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1xqag1256915672.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/freestat/rcomp/tmp/2z8z31256915672.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/freestat/rcomp/tmp/3k8rt1256915672.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/freestat/rcomp/tmp/4eo7s1256915672.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/freestat/rcomp/tmp/590911256915672.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/freestat/rcomp/tmp/6gyly1256915672.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/freestat/rcomp/tmp/7cjnx1256915672.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/freestat/rcomp/tmp/8679p1256915672.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. -4535 -4507 -4485 -4472 -4445 -4267 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9ou7z1256915672.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/freestat/rcomp/tmp/10jbni1256915672.tab") > > system("convert tmp/1xqag1256915672.ps tmp/1xqag1256915672.png") > system("convert tmp/2z8z31256915672.ps tmp/2z8z31256915672.png") > system("convert tmp/3k8rt1256915672.ps tmp/3k8rt1256915672.png") > system("convert tmp/4eo7s1256915672.ps tmp/4eo7s1256915672.png") > system("convert tmp/590911256915672.ps tmp/590911256915672.png") > system("convert tmp/6gyly1256915672.ps tmp/6gyly1256915672.png") > system("convert tmp/7cjnx1256915672.ps tmp/7cjnx1256915672.png") > system("convert tmp/8679p1256915672.ps tmp/8679p1256915672.png") > > > proc.time() user system elapsed 2.471 1.848 2.822