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(6.000424288,5.831882477,5.969218938,5.982928216,6.073274922,6.036198878,5.932775551,6.05161847,6.232644461,6.117436187,6.076724391,6.008321664,6.059823885,6.036437913,6.357322201,6.187853361,6.047372179,6.197054939,6.191953408,6.258816353,6.03667689,6.155494834,6.051147549,6.20617262,6.193384462,6.132747072,6.242806753,6.220987705,6.330789853,6.435509137,6.220788957,6.514119923,6.196444128,6.265871392,6.217802989,6.27117745,6.295081483,6.509067155,6.512339507,6.41395064,6.43775165,6.332924325,6.343001313,6.538718527,6.288601778,6.276831442,6.388561406,6.463185451,6.464432528,6.490419998,6.631342799,6.670512803,6.852348272,6.477895014,6.487227293,6.654281378,6.416732283,6.299133053,6.121834698,6.049497578,6.199494461) > x <- c(200.1,172,136.1,182.6,208.7,142.3,188.8,143.9,149.7,196.9,231.5,219.2,220.7,244.2,182.5,229.8,238.1,206.5,249.3,181.8,218,246.4,214.3,242.3,220.7,204.5,180.7,233,236.5,239.4,208.7,209,247.2,284.3,245.8,249.1,251.4,251.2,207.2,228.3,254.3,217.9,244.4,233.2,212.6,239.5,335.5,248.8,264.6,275.4,180.7,256.1,247.4,227.8,248.1,153.7,225.5,274.4,400.3,301.8,345.2) > 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.2382460946 2 -0.3839943049 3 -0.2175371939 4 -0.2415468637 5 -0.1723714380 6 -0.1555864470 7 -0.2967287217 8 -0.1414647112 9 0.0348565508 10 -0.1186384830 11 -0.1874164208 12 -0.2458418777 13 -0.1955563970 14 -0.2380046329 15 0.1329282374 16 -0.0749084785 17 -0.2221222899 18 -0.0468068686 19 -0.0866260547 20 0.0349902015 21 -0.2165132595 22 -0.1207322643 23 -0.1990413079 24 -0.0667287216 25 -0.0619958200 26 -0.1094924153 27 0.0198728777 28 -0.0443698470 29 0.0625932404 30 0.1649601599 31 -0.0248574030 32 0.2682302150 33 -0.0804318984 34 -0.0410986766 35 -0.0579374132 36 -0.0072397807 37 0.0147985839 38 0.2289464879 39 0.2679098873 40 0.1524055407 41 0.1551163864 42 0.0798152915 43 0.0683965351 44 0.2731987429 45 0.0397918934 46 0.0062013489 47 0.0400599369 48 0.1850115683 49 0.1734423147 50 0.1906692549 51 0.4084089237 52 0.3864174511 53 0.5753100136 54 0.2167554948 55 0.2096212225 56 0.4532488271 57 0.1574584322 58 0.0001934701 59 -0.2792299498 60 -0.2716677935 61 -0.1568752617 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1zpfn1256676193.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/2qsiu1256676193.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/3bfp31256676193.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/4uahk1256676193.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/50h6g1256676193.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/62hfl1256676193.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/7q31k1256676193.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/8k36l1256676193.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. 136.1 206.5 229.8 228.4 248.1 400.3 > > #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/9wa501256676193.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/10ces51256676193.tab") > > system("convert tmp/1zpfn1256676193.ps tmp/1zpfn1256676193.png") > system("convert tmp/2qsiu1256676193.ps tmp/2qsiu1256676193.png") > system("convert tmp/3bfp31256676193.ps tmp/3bfp31256676193.png") > system("convert tmp/4uahk1256676193.ps tmp/4uahk1256676193.png") > system("convert tmp/50h6g1256676193.ps tmp/50h6g1256676193.png") > system("convert tmp/62hfl1256676193.ps tmp/62hfl1256676193.png") > system("convert tmp/7q31k1256676193.ps tmp/7q31k1256676193.png") > system("convert tmp/8k36l1256676193.ps tmp/8k36l1256676193.png") > > > proc.time() user system elapsed 1.990 1.780 3.471