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(14271,14013,15912,14290,14744,14721,13918,13263,15660,15629,15113,14526,15132,14908,16167,14122,13985,14236,13921,12394,15454,16146,15107,14593,14695,14513,17071,15179,15460,17173,15938,15003,18216,17847,18029,17281,16706,16750,18912,17763,16736,18061,16713,16769,19514,19251,19951,19052,19555,19083,22534,18854,19801,20346,18169,19087,20842,21602,22360,20334,21215,20530,23152,20134,21193,21628,20823,20493,22106,24178,24958,21620) > x <- c(9356,9337,10149,9788,9770,9911,9429,8775,10189,10529,9914,9790,9625,9729,10589,9611,9388,9510,9690,8434,9844,10601,9942,10229,9381,9635,11228,9999,10089,11622,10533,9965,11567,11321,11686,11747,10595,10751,12199,11690,10978,11753,10839,10518,12183,11967,12363,12359,12162,12096,14325,12670,13865,13563,12734,12464,13389,13961,14088,13143,13413,13579,15388,13708,14689,14883,13991,13854,14364,15672,15904,14016) > 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 54.696086 2 -173.999011 3 472.601983 4 -592.604863 5 -110.842323 6 -351.315550 7 -410.896435 8 -57.190832 9 158.907451 10 -396.496074 11 36.057360 12 -359.689589 13 500.800357 14 116.394572 15 48.962128 16 -487.606557 17 -280.659539 18 -217.827863 19 -810.453258 20 -400.244944 21 485.022792 22 9.453768 23 -13.128812 24 -969.787082 25 440.137004 26 -133.623277 27 -32.608026 28 -29.043521 29 113.143782 30 -538.299170 31 -93.665527 32 -152.603168 33 589.530812 34 599.952186 35 218.989579 36 -623.094583 37 578.707948 38 382.099272 39 310.757202 40 -53.179875 41 17.982801 42 147.651237 43 209.371301 44 760.469922 45 937.435014 46 1007.585489 47 1096.809619 48 203.979072 49 1010.824644 50 640.620622 51 653.692809 52 -473.695917 53 -1369.820070 54 -359.026351 55 -1257.407168 56 77.030925 57 405.344865 58 283.113053 59 845.232913 60 276.766239 61 741.328146 62 -199.704164 63 -367.839388 64 -794.669030 65 -1248.727436 66 -1112.945917 67 -542.157847 68 -660.854073 69 165.540640 70 220.129433 71 642.301145 72 216.283071 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1435x1257504476.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/2nds31257504476.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/396j71257504476.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/4ik291257504476.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/5r5881257504476.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/6glza1257504476.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/7qgbj1257504476.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/8tenb1257504476.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. 8434 9913 11270 11570 13200 15900 > > #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/9ysoa1257504476.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/10dvgf1257504476.tab") > > system("convert tmp/1435x1257504476.ps tmp/1435x1257504476.png") > system("convert tmp/2nds31257504476.ps tmp/2nds31257504476.png") > system("convert tmp/396j71257504476.ps tmp/396j71257504476.png") > system("convert tmp/4ik291257504476.ps tmp/4ik291257504476.png") > system("convert tmp/5r5881257504476.ps tmp/5r5881257504476.png") > system("convert tmp/6glza1257504476.ps tmp/6glza1257504476.png") > system("convert tmp/7qgbj1257504476.ps tmp/7qgbj1257504476.png") > system("convert tmp/8tenb1257504476.ps tmp/8tenb1257504476.png") > > > proc.time() user system elapsed 1.980 1.680 2.831