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(98.3,112.3,113.9,106.2,98.6,96.5,95.9,103.7,103.1,103.7,112.1,86.9,95,111.8,108.8,109.3,101.4,100.5,100.7,113.5,106.1,111.6,114.9,88.6,99.5,115.1,118,111.4,107.3,105.3,105.3,117.9,110.2,112.4,117.5,93,103.5,116.3,120,114.3,104.7,109.8,112.6,114.4,115.7,114.7,118.4,94.9,103.8,115.1,113.7,104,94.3,92.5,93.2,104.7,94,98.1,102.7,82.4) > x <- c(216.9,217.2,217.5,217.9,218.1,218.6,218.9,219.3,220.4,220.9,221,221.8,222,222.2,222.5,222.9,223.1,223.4,224,225.1,225.5,225.9,226.3,226.5,227,227.3,227.8,228.1,228.4,228.5,228.8,229,229.1,229.3,229.6,229.9,230,230.2,230.8,231,231.7,231.9,233,235.1,236,236.9,237.1,237.5,238.2,238.9,239.1,240,240.2,240.5,240.7,241.1,241.4,242.2,242.9,243.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 -8.42027606 2 5.60381055 3 7.22789716 4 -0.43998737 5 -8.02392963 6 -10.08378528 7 -10.65969868 8 -2.82758320 9 -3.33926564 10 -2.69912129 11 5.70890758 12 -19.42686147 13 -11.31080373 14 5.50525401 15 2.52934061 16 3.06145609 17 -4.82248617 18 -5.69839956 19 -5.45022635 20 7.43809121 21 0.07020669 22 5.60232216 23 8.93443764 24 -17.34950462 25 -6.40936027 26 9.21472633 27 12.15487068 28 5.57895729 29 1.50304389 30 -0.48892724 31 -0.46484063 32 12.15121711 33 4.45924598 34 6.67530372 35 11.79939032 36 -12.67652307 37 -2.16849420 38 10.64756354 39 14.39573675 40 8.71179449 41 -0.83200343 42 4.28405431 43 7.17237187 44 9.14097813 45 10.51323795 46 9.58549777 47 13.30155551 48 -10.16632902 49 -1.21012693 50 10.14607515 51 8.76213289 52 -0.86560729 53 -10.54954955 54 -12.32546294 55 -11.60940520 56 -0.07728973 57 -10.75320312 58 -6.58897217 59 -1.93277008 60 -22.20868347 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1cav11257096921.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/29d3s1257096921.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/38bqa1257096921.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/4w4gh1257096921.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/5c0wo1257096921.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/6unt61257096921.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/7rdwb1257096921.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/8zem71257096921.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. 216.9 222.8 228.6 229.2 236.2 243.2 > > #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/9tax21257096921.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/10sk371257096921.tab") > > system("convert tmp/1cav11257096921.ps tmp/1cav11257096921.png") > system("convert tmp/29d3s1257096921.ps tmp/29d3s1257096921.png") > system("convert tmp/38bqa1257096921.ps tmp/38bqa1257096921.png") > system("convert tmp/4w4gh1257096921.ps tmp/4w4gh1257096921.png") > system("convert tmp/5c0wo1257096921.ps tmp/5c0wo1257096921.png") > system("convert tmp/6unt61257096921.ps tmp/6unt61257096921.png") > system("convert tmp/7rdwb1257096921.ps tmp/7rdwb1257096921.png") > system("convert tmp/8zem71257096921.ps tmp/8zem71257096921.png") > > > proc.time() user system elapsed 1.550 1.111 1.952