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(2058.00,2160.00,2260.00,2498.00,2695.00,2799.00,2947.00,2930.00,2318.00,2540.00,2570.00,2669.00,2450.00,2842.00,3440.00,2678.00,2981.00,2260.00,2844.00,2546.00,2456.00,2295.00,2379.00,2479.00,2057.00,2280.00,2351.00,2276.00,2548.00,2311.00,2201.00,2725.00,2408.00,2139.00,1898.00,2537.00,2069.00,2063.00,2526.00,2440.00,2191.00,2797.00,2074.00,2628.00,2287.00,2146.00,2430.00,2141.00,1827.00,2082.00,1788.00,1743.00,2245.00,1963.00,1828.00,2527.00,2114.00,2424.00) > x <- c(8.20,8.30,8.50,8.60,8.50,8.20,8.10,7.90,8.60,8.70,8.70,8.50,8.40,8.50,8.70,8.70,8.60,8.50,8.30,8.00,8.20,8.10,8.10,8.00,7.90,7.90,8.00,8.00,7.90,8.00,7.70,7.20,7.50,7.30,7.00,7.00,7.00,7.20,7.30,7.10,6.80,6.40,6.10,6.50,7.70,7.90,7.50,6.90,6.60,6.90,7.70,8.00,8.00,7.70,7.30,7.40,8.10,8.30) > 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 -397.3205077 2 -313.8820337 3 -251.0050857 4 -31.5666116 5 183.9949143 6 343.6794923 7 510.2410182 8 530.3640702 9 -211.5666116 10 -8.1281376 11 21.8718624 12 157.9949143 13 -42.4435597 14 330.9949143 15 891.8718624 16 129.8718624 17 451.4333884 18 -251.0050857 19 370.1179663 20 127.8025442 21 0.6794923 22 -141.7589818 23 -57.7589818 24 60.8025442 25 -342.6359298 26 -119.6359298 27 -67.1974558 28 -142.1974558 29 148.3640702 30 -107.1974558 31 -161.5128779 32 455.2947520 33 82.6101741 34 -149.2667740 35 -334.5821960 36 304.4178040 37 -163.5821960 38 -206.7052480 39 237.7332260 40 188.8562780 41 -4.4591441 42 675.7869598 43 8.4715377 44 488.2254338 45 -75.5128779 46 -253.6359298 47 104.6101741 48 -73.0206701 49 -331.3360921 50 -132.0206701 51 -574.5128779 52 -675.1974558 53 -173.1974558 54 -399.5128779 55 -460.2667740 56 220.1717001 57 -322.7589818 58 -49.8820337 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/15h8b1260817127.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/2g8wk1260817127.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/3uxcj1260817127.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/4g69q1260817127.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/5cznr1260817127.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/68riz1260817127.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/7v7cp1260817127.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/8otqk1260817127.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. 6.100 7.300 8.000 7.805 8.300 8.700 > > #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/9plhq1260817127.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/10vdnp1260817127.tab") > > try(system("convert tmp/15h8b1260817127.ps tmp/15h8b1260817127.png",intern=TRUE)) character(0) > try(system("convert tmp/2g8wk1260817127.ps tmp/2g8wk1260817127.png",intern=TRUE)) character(0) > try(system("convert tmp/3uxcj1260817127.ps tmp/3uxcj1260817127.png",intern=TRUE)) character(0) > try(system("convert tmp/4g69q1260817127.ps tmp/4g69q1260817127.png",intern=TRUE)) character(0) > try(system("convert tmp/5cznr1260817127.ps tmp/5cznr1260817127.png",intern=TRUE)) character(0) > try(system("convert tmp/68riz1260817127.ps tmp/68riz1260817127.png",intern=TRUE)) character(0) > try(system("convert tmp/7v7cp1260817127.ps tmp/7v7cp1260817127.png",intern=TRUE)) character(0) > try(system("convert tmp/8otqk1260817127.ps tmp/8otqk1260817127.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.611 1.189 3.908