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.442651256,4.565389316,4.732683506,4.76046307,4.631812117,4.670957927,4.821893169,4.768988271,4.80073697,4.769836808,4.713127327,4.698660529,4.528289142,4.653007515,4.789988623,4.692264893,4.533674184,4.469350463,4.671893818,4.625952725,4.628886713,4.730039168,4.611152258,4.639571613,4.540098189,4.630837933,4.683056725,4.662495253,4.467056884,4.404277244,4.642465971,4.562262685,4.529368473,4.616110126,4.477336814,4.53044664,4.496470769,4.56017282,4.555979942,4.573679519,4.371976299,4.297285406,4.602165677,4.475061501,4.514150788,4.542230386,4.49980967,4.497584975,4.487512143,4.646312129,4.707726774,4.705015521,4.467056884,4.49088104,4.569543008,4.558078578,4.615120517,4.678420648,4.541164856,4.541164856) > x <- c(160,171.4,192,231.2,250.8,268.4,266.9,268.5,268.2,265.3,253.8,243.4,213.6,221,227.3,221.6,222.1,232.2,229.6,238.9,238.2,223.9,215,211.1,210.6,206.6,207,201.7,204.5,204.5,195.1,205.5,187.5,173.5,172.3,167.5,157.5,151.1,148.5,147.9,145.6,139.8,138.9,141.4,148.7,150.9,147.3,144.5,134,135.1,131.4,128.4,127.6,127.4,124,123.5,128,129.9,127.6,121.8) > 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.117827584 2 -0.010054381 3 0.130198051 4 0.106519511 5 -0.047860494 6 -0.031818323 7 0.121085979 8 0.066080750 9 0.098223262 10 0.071129949 11 0.029516595 12 0.028701948 13 -0.102550779 14 0.012453564 15 0.141164620 16 0.050923318 17 -0.108323744 18 -0.185905803 19 0.020050589 20 -0.038098676 21 -0.034245793 22 0.085678368 23 -0.021525452 24 0.012013459 25 -0.086803612 26 0.009186959 27 0.060880669 28 0.047276542 29 -0.151837406 30 -0.214617046 31 0.035911125 32 -0.057944311 33 -0.067209802 34 0.037909745 35 -0.099288319 36 -0.039877500 37 -0.060726304 38 0.011377070 39 0.010597230 40 0.029084431 41 -0.169599564 42 -0.236676758 43 0.069384949 44 -0.061000994 45 -0.031494466 46 -0.006302823 47 -0.043997794 48 -0.042546910 49 -0.038836322 50 0.118519687 51 0.184791347 52 0.186018214 53 -0.050890258 54 -0.026803560 55 0.056321611 56 0.045513534 57 0.096648293 58 0.157454281 59 0.023217714 60 0.030831413 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1xhp31257172423.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/2uama1257172423.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/3cf731257172423.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/4cplx1257172423.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/5vjjf1257172423.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/6b8p61257172423.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/70l5p1257172423.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/829ly1257172423.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. 121.8 143.7 189.8 186.2 222.6 268.5 > > #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/9ad5f1257172423.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/105i1t1257172423.tab") > system("convert tmp/1xhp31257172423.ps tmp/1xhp31257172423.png") > system("convert tmp/2uama1257172423.ps tmp/2uama1257172423.png") > system("convert tmp/3cf731257172423.ps tmp/3cf731257172423.png") > system("convert tmp/4cplx1257172423.ps tmp/4cplx1257172423.png") > system("convert tmp/5vjjf1257172423.ps tmp/5vjjf1257172423.png") > system("convert tmp/6b8p61257172423.ps tmp/6b8p61257172423.png") > system("convert tmp/70l5p1257172423.ps tmp/70l5p1257172423.png") > system("convert tmp/829ly1257172423.ps tmp/829ly1257172423.png") > > > proc.time() user system elapsed 1.603 1.175 3.332