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(52.034,58.146,79.035,63.969,34.831,42.602,23.589,21.974,29.651,39.547,27.957,10.511,63.044,50.898,63.547,55.028,40.073,56.080,28.091,29.211,33.415,35.336,31.502,1.007,75.840,69.091,88.380,61.147,59.750,50.533,33.467,28.944,32.053,42.095,27.840,-686,69.362,55.107,73.801,50.981,48.575,52.660,37.173,25.894,30.201,46.248,26.577,1.911,68.401,65.458,67.183,76.063,48.064,52.591,34.502,22.268,30.174,39.902,14.115,-2.715) > x <- c(4651.600942,4648.46719,4629.664677,4595.193403,4573.257137,4592.05965,4751.881013,4805.154801,4811.422306,4805.154801,4751.881013,4755.014766,4742.479757,4736.212252,4720.543491,4686.072217,4667.269704,4673.537208,4836.492323,4861.562341,4858.428589,4808.288553,4755.014766,4761.28227,4748.747261,4739.346005,4708.008482,4689.205969,4686.072217,4686.072217,4833.358571,4852.161084,4833.358571,4733.0785,4664.135951,4635.932181,4648.46719,4610.862164,4557.588376,4538.785863,4491.779579,4454.174553,4629.664677,4661.002199,4588.925898,4541.919615,4488.645827,4501.180836,4510.582093,4482.378323,4435.37204,4425.970783,4360.161986,4388.365756,4545.053367,4563.85588,4513.715845,4476.110818,4463.57581,4507.448341) > 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 20.6918402 2 26.7432149 3 47.2684633 4 31.5355852 5 1.9732083 6 10.1079599 7 -5.8131509 8 -6.3975212 9 1.4007294 10 11.1754788 11 -1.4451509 12 -18.8305256 13 33.4599733 14 21.1927227 15 33.5385963 16 24.3527183 17 9.0339666 18 25.1622172 19 0.3257316 20 1.9307338 21 6.0741086 22 7.0251041 23 2.1604744 24 -28.2132751 25 46.3772238 26 39.4463480 27 58.1290952 28 30.5323435 29 29.0747183 30 19.8577183 31 5.6411063 32 1.4818580 33 4.2271063 34 12.3290974 35 -3.2596587 36 -717.6452862 37 37.9592149 38 22.9767116 39 40.6400819 40 17.4563302 41 14.1409510 42 17.4984477 43 5.4064633 44 -5.2662840 45 -2.3536654 46 12.7839555 47 -7.9176742 48 -32.3411731 49 34.3307027 50 30.8420752 51 31.6576960 52 40.3558202 53 11.0836894 54 16.1563169 55 1.0985808 56 -10.7716676 57 -3.8356720 58 5.1648246 59 -20.8646765 60 -36.8459226 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1j4vt1257354254.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/2r4m31257354254.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/33skp1257354254.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/46p4s1257354254.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/5qjs71257354254.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/6jjp71257354254.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/7q1881257354254.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/8hlh31257354254.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. 4360 4541 4656 4645 4750 4862 > > #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/9qegz1257354254.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/10g96r1257354254.tab") > > system("convert tmp/1j4vt1257354254.ps tmp/1j4vt1257354254.png") > system("convert tmp/2r4m31257354254.ps tmp/2r4m31257354254.png") > system("convert tmp/33skp1257354254.ps tmp/33skp1257354254.png") > system("convert tmp/46p4s1257354254.ps tmp/46p4s1257354254.png") > system("convert tmp/5qjs71257354254.ps tmp/5qjs71257354254.png") > system("convert tmp/6jjp71257354254.ps tmp/6jjp71257354254.png") > system("convert tmp/7q1881257354254.ps tmp/7q1881257354254.png") > system("convert tmp/8hlh31257354254.ps tmp/8hlh31257354254.png") > > > proc.time() user system elapsed 2.531 1.874 2.968