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(0.86,0.88,0.88,0.88,0.87,0.88,0.87,0.85,0.84,0.83,0.86,0.87,0.85,0.89,0.98,1.01,1,1.01,1.05,1,0.99,1.02,1.11,1.15,1.18,1.2,1.22,1.2,1.23,1.23,1.21,1.25,1.2,1.2,1.21,1.25,1.23,1.2,1.18,1.16,1.12,1.11,1.1,1.08,1.01,1.01,0.99,1.07,1.13,1.09,0.95,0.79,0.73,0.7,0.65,0.61,0.53,0.51,0.41,0.42) > x <- c(2756.76,2849.27,2921.44,2981.85,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3801.06,3570.12,3701.61,3862.27,3970.1,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.4,4562.84,4202.52,4296.49,4435.23,4105.18,4116.68,3844.49,3720.98,3674.4,3857.62,3801.06,3504.37,3032.6,3047.03,2962.34,2197.82,2014.45,1862.83,1905.41,1810.99,1670.07,1864.44,2052.02,2029.6,2070.83,2293.41,2443.27) > 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.0048780871 2 0.0060869500 3 -0.0085726150 4 -0.0208434246 5 -0.0508980021 6 -0.0461061391 7 -0.0587650515 8 -0.0669736180 9 -0.0842962912 10 -0.1073735088 11 -0.0967658973 12 -0.0907979379 13 -0.1145171652 14 -0.0884657911 15 -0.0249086646 16 -0.0300209331 17 -0.0696833453 18 -0.0809912069 19 -0.0364310401 20 -0.0672458396 21 -0.0303360439 22 -0.0270450118 23 0.0303208504 24 0.0484178312 25 0.0442074398 26 0.0517700673 27 0.0532572121 28 0.0021749529 29 0.0202453942 30 0.0498326499 31 -0.0177576161 32 0.0007740531 33 -0.0338777865 34 -0.0219827590 35 0.0612074098 36 0.0821197095 37 0.0339380820 38 0.0709796429 39 0.0486437000 40 0.0839324213 41 0.0690204479 42 0.0684820322 43 0.0212653839 44 0.0127541604 45 0.0030194556 46 0.0988479579 47 0.0759168574 48 0.1731195533 49 0.3884130365 50 0.3856601537 51 0.2764580372 52 0.1078089547 53 0.0669880615 54 0.0656125025 55 -0.0238689948 56 -0.1019712702 57 -0.1774171972 58 -0.2057920603 59 -0.3510037270 60 -0.3714441098 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/164q81257799130.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/2x7d61257799130.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/39b8y1257799130.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/4hmox1257799130.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/5u7j31257799130.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/6fj1n1257799130.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/70ntx1257799130.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/8ucf21257799130.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. 1670 2952 3499 3371 4004 4697 > > #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/91lj01257799130.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/10uzsh1257799131.tab") > > system("convert tmp/164q81257799130.ps tmp/164q81257799130.png") > system("convert tmp/2x7d61257799130.ps tmp/2x7d61257799130.png") > system("convert tmp/39b8y1257799130.ps tmp/39b8y1257799130.png") > system("convert tmp/4hmox1257799130.ps tmp/4hmox1257799130.png") > system("convert tmp/5u7j31257799130.ps tmp/5u7j31257799130.png") > system("convert tmp/6fj1n1257799130.ps tmp/6fj1n1257799130.png") > system("convert tmp/70ntx1257799130.ps tmp/70ntx1257799130.png") > system("convert tmp/8ucf21257799130.ps tmp/8ucf21257799130.png") > > > proc.time() user system elapsed 1.637 1.186 2.621