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(3.8,4.7,4.3,3.9,4,4.3,4.8,4.4,4.3,4.7,4.7,4.9,5,4.2,4.3,4.8,4.8,4.8,4.2,4.6,4.8,4.5,4.4,4.3,3.9,3.7,4,4.1,3.7,3.8,3.8,3.8,3.3,3.3,3.3,3.2,3.4,4.2,4.9,5.1,5.5,5.6,6.4,6.1,7.1,7.8,7.9,7.4,7.5,6.8,5.2,4.7,4.1,3.9,2.6,2.7,1.8,1,0.3,1.3) > x <- c(25921,22201,19321,18225,16900,16129,14884,13689,12544,12769,22201,24649,24649,21609,18769,17424,15625,15129,13689,12996,12321,12544,20736,22500,22201,17956,15129,13456,13689,12321,11025,10404,9025,8649,15376,16900,15376,13225,11236,11025,11025,10201,9025,8649,7056,7569,13456,14400,13689,11881,11025,11449,11881,11881,11664,11449,9801,10609,17161,18769) > 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.02419317 2 0.71492851 3 0.15291717 4 -0.30873715 5 -0.28327361 6 -0.02664540 7 0.40331845 8 -0.06390501 9 -0.22831577 10 0.18434136 11 0.71492851 12 1.05263816 13 1.15263816 14 0.18162618 15 0.12186500 16 0.54620345 17 0.44500261 18 0.41710066 19 -0.26390501 20 0.09711101 21 0.25913960 22 -0.02831577 23 0.33251649 24 0.33174844 25 -0.08507149 26 -0.52386946 27 -0.38289934 28 -0.37701218 29 -0.76390501 30 -0.74086040 31 -0.81376550 32 -0.84869920 33 -1.42627338 34 -1.44742486 35 -1.06900462 36 -1.08327361 37 -0.96900462 38 -0.29000684 39 0.29810408 40 0.48623450 41 0.88623450 42 0.93988125 43 1.67372662 44 1.35257514 45 2.26296261 46 2.99182088 47 3.42298782 48 2.97609154 49 3.03609499 50 2.23438787 51 0.58623450 52 0.11008617 53 -0.46561213 54 -0.66561213 55 -1.97781924 56 -1.88991383 57 -2.88262032 58 -3.63716714 59 -3.96859134 60 -2.87813500 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1vhy81256670530.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/2oiao1256670530.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/3cz7h1256670530.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/4gze11256670530.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/5v1bl1256670530.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/6epft1256670530.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/78mj71256670530.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/821hw1256670530.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. 7056 11400 13570 14620 17230 25920 > > #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/9f6ox1256670530.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/109is81256670531.tab") > > system("convert tmp/1vhy81256670530.ps tmp/1vhy81256670530.png") > system("convert tmp/2oiao1256670530.ps tmp/2oiao1256670530.png") > system("convert tmp/3cz7h1256670530.ps tmp/3cz7h1256670530.png") > system("convert tmp/4gze11256670530.ps tmp/4gze11256670530.png") > system("convert tmp/5v1bl1256670530.ps tmp/5v1bl1256670530.png") > system("convert tmp/6epft1256670530.ps tmp/6epft1256670530.png") > system("convert tmp/78mj71256670530.ps tmp/78mj71256670530.png") > system("convert tmp/821hw1256670530.ps tmp/821hw1256670530.png") > > > proc.time() user system elapsed 1.690 1.510 3.229