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(85.9,76.8,96.2,83.9,88.7,105.4,86.7,76.3,93.2,105.1,121,107.85,94.7,78.4,101.4,91.2,89.9,112.2,81.5,78.8,99.1,101.3,91.5,89.05,86.6,86.6,98.5,86.7,89.1,111,92.6,85.1,116.1,98.3,97.7,95.95,94.2,83.8,109.5,102.3,102.5,93.9,85.3,88.2,104.7,99.4,113.8,101.5,89.2,93.2,115,97.2,112.5,121.8,100.2,93.8,113.6,110.7,127.6,116.75) > x <- c(252.5,251.1,255.1,258.3,255.3,261.1,253.8,252.9,253.9,255.5,262,262.8,263.3,262.5,269.2,270.8,274.1,273,267.3,267.1,268.2,270.2,271.5,281,280.1,281.5,285.9,289.8,292.9,291.2,291.8,289.8,292.5,290.3,297.5,307.5,304.7,304.6,310.7,310.7,315.7,314.7,312.2,312.8,314.3,319.7,319.9,329.5,326.9,329.7,335.7,337.2,339.7,338.3,339.2,342.5,342.2,338.3,339,345.9) > 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 -3.7990469 2 -12.6339787 3 6.0086835 4 -6.8971868 5 -1.5291834 6 14.0726768 7 -3.2451817 8 -13.4747807 9 3.2358849 10 14.8329497 11 29.5022758 12 16.2008082 13 2.9561410 14 -13.1923915 15 8.5390677 16 -1.9638675 17 -3.8886712 18 18.6195967 19 -11.0011969 20 -13.6633300 21 6.4284021 22 8.2497332 23 -1.7964016 24 -6.0450789 25 -8.3246779 26 -8.5897462 27 2.4771822 28 -10.0612222 29 -8.2481590 30 13.9737096 31 -4.5398911 32 -11.6612222 33 18.8275748 34 1.4441106 35 -0.5190975 36 -4.1624421 37 -5.3823056 38 -15.7633722 39 8.7816876 40 1.5816876 41 0.8350154 42 -7.5756502 43 -15.7023140 44 -12.9159147 45 3.3000836 46 -3.0223225 47 11.3398106 48 -2.7778002 49 -14.5855306 50 -11.1156671 51 9.5483262 52 -8.5356755 53 6.2909884 54 15.8560566 55 -5.9143444 56 -12.9391481 57 6.9176522 58 4.7560566 59 21.5235225 60 9.3671147 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1l5ee1257331345.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/2dnb81257331345.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/3dfxe1257331345.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/449zi1257331345.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/50m971257331345.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/62edl1257331345.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/7tzv21257331345.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/8bgff1257331345.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. 251.1 267.2 290.8 293.8 316.7 345.9 > > #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/9vlab1257331345.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/10p91i1257331345.tab") > > system("convert tmp/1l5ee1257331345.ps tmp/1l5ee1257331345.png") > system("convert tmp/2dnb81257331345.ps tmp/2dnb81257331345.png") > system("convert tmp/3dfxe1257331345.ps tmp/3dfxe1257331345.png") > system("convert tmp/449zi1257331345.ps tmp/449zi1257331345.png") > system("convert tmp/50m971257331345.ps tmp/50m971257331345.png") > system("convert tmp/62edl1257331345.ps tmp/62edl1257331345.png") > system("convert tmp/7tzv21257331345.ps tmp/7tzv21257331345.png") > system("convert tmp/8bgff1257331345.ps tmp/8bgff1257331345.png") > > > proc.time() user system elapsed 1.627 1.182 2.637