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(4.379523504,4.423648309,4.732683506,4.726502471,4.644390899,4.699570861,4.59511985,4.666265285,4.85903691,4.710430697,4.633757643,4.86753445,4.465908119,4.471638793,4.767289035,4.638604962,4.707726774,4.723841716,4.629862799,4.722063937,4.909709376,4.654912278,4.849683763,4.919980926,4.510859507,4.505349851,4.80729437,4.81462041,4.822697999,4.787491743,4.771531723,4.779123493,4.960744524,4.817050545,4.864452784,5.021245473,4.704110134,4.597138014,4.871373227,4.914124394,4.865224091,4.852030264,4.80073697,4.911183215,4.968423445,4.993828176,4.914124394,5.053694784,4.81462041,4.649187071,4.94021283,4.916324615,4.71939133,4.774912961,4.547541073,4.627909673,4.713127327,4.597138014,4.475061501,4.751864565) > x <- c(4.699297849,4.561636184,4.812672041,4.815350071,4.789822358,4.747797584,4.704110134,4.740487483,4.883029169,4.813484323,4.777609743,4.854527144,4.720639436,4.649474112,4.887110808,4.808274282,4.881285622,4.824707242,4.795459912,4.808927024,4.980313534,4.775503503,4.899703733,4.917788744,4.798843731,4.715189831,4.900969227,4.924714232,4.926238677,4.785573237,4.872828107,4.854215375,4.993489135,4.855306142,4.919250732,4.969466017,4.910004317,4.807947751,4.918739279,5.030699325,4.960814599,4.815917217,4.972379449,4.984633492,4.994573661,5.065817683,4.99314998,5.106248458,5.041099835,4.83786795,5.058536174,5.037926154,4.813890217,4.728007096,4.70456293,4.732419387,4.807621114,4.744323247,4.717158688,4.836599317) > 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.181522676 2 0.027484232 3 0.035845163 4 0.026456560 5 -0.025079594 6 0.080434883 7 0.028309831 8 0.055884866 9 0.077929419 10 0.012619456 11 -0.021085381 12 0.120564813 13 -0.120699613 14 -0.029731786 15 -0.018707175 16 -0.052966034 17 -0.071292411 18 0.012588400 19 -0.046359986 20 0.029711130 21 0.012081061 22 0.002591969 23 0.048604574 24 0.097240699 25 -0.169416194 26 -0.074730702 27 0.004699456 28 -0.016414712 29 -0.010163003 30 0.123110568 31 0.002642394 32 0.032527273 33 0.047335339 34 0.069147876 35 0.039961483 36 0.136609601 37 -0.109306418 38 -0.094041884 39 0.047494511 40 -0.043852713 41 -0.009049680 42 0.151305063 43 -0.087388419 44 0.008380738 45 0.053715286 46 -0.006211395 47 0.001121426 48 0.005229886 49 -0.155813745 50 -0.077829277 51 -0.051105427 52 -0.050308314 53 0.021093936 54 0.179480730 55 -0.019811275 56 0.027192690 57 0.022338653 58 -0.017836631 59 -0.107377219 60 0.026367702 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1bf0n1256685631.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/24jug1256685631.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/3bnr61256685631.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/4hu4j1256685631.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/5n1vp1256685631.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/6xntf1256685631.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/7w3jz1256685631.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/8duyv1256685631.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. 4.562 4.784 4.837 4.855 4.925 5.106 > > #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/98y4z1256685631.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/101u521256685631.tab") > > system("convert tmp/1bf0n1256685631.ps tmp/1bf0n1256685631.png") > system("convert tmp/24jug1256685631.ps tmp/24jug1256685631.png") > system("convert tmp/3bnr61256685631.ps tmp/3bnr61256685631.png") > system("convert tmp/4hu4j1256685631.ps tmp/4hu4j1256685631.png") > system("convert tmp/5n1vp1256685631.ps tmp/5n1vp1256685631.png") > system("convert tmp/6xntf1256685631.ps tmp/6xntf1256685631.png") > system("convert tmp/7w3jz1256685631.ps tmp/7w3jz1256685631.png") > system("convert tmp/8duyv1256685631.ps tmp/8duyv1256685631.png") > > > proc.time() user system elapsed 1.643 1.193 3.743