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(12002.4,15525.5,14247.9,15000.7,14931.4,13333.7,14711.2,17197.3,14985.2,14734.4,15937.8,13028.1,13836.8,16677.5,15130,17504,16979.9,16012.5,16247.7,19268.2,15533,16803.3,17396.1,15155.4,15692.4,18063.7,17568.6,18154.3,15467.4,16956.1,16854,19396.4,16457.6,17284.5,18395.3,16938.7,16414.3,18173.4,19919.7,19623.8,17228.1,18730.3,19039.1,19413.3,20013.6,17917.2,21270.3,18766.1,16790.8,19960.6,19586.7,17179,14964.9,13918.5,14401.3,15994.6,14521.1,13746.5,15956,14332.2) > x <- c(2,1.8,2.7,2.3,1.9,2,2.3,2.8,2.4,2.3,2.7,2.7,2.9,3,2.2,2.3,2.8,2.8,2.8,2.2,2.6,2.8,2.5,2.4,2.3,1.9,1.7,2,2.1,1.7,1.8,1.8,1.8,1.3,1.3,1.3,1.2,1.4,2.2,2.9,3.1,3.5,3.6,4.4,4.1,5.1,5.8,5.9,5.4,5.5,4.8,3.2,2.7,2.1,1.9,0.6,0.7,-0.2,-1,-1.7) > 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 -4305.26705 2 -644.86503 3 -2540.32413 4 -1512.92008 5 -1307.61604 6 -2973.96705 7 -1802.42008 8 340.42486 9 -1597.07109 10 -1779.22008 11 -850.42413 12 -3760.12413 13 -3088.72615 14 -316.67716 15 -1314.96907 16 990.37992 17 123.02486 18 -844.37514 19 -609.17514 20 2823.23093 21 -1186.57312 22 -53.57514 23 745.17790 24 -1426.87109 25 -821.22008 26 1824.68396 27 1466.88598 28 1846.63295 29 -908.91806 30 854.38598 31 683.63497 32 3226.03497 33 287.23497 34 1457.39002 35 2568.19002 36 1111.59002 37 655.84104 38 2277.63901 39 3474.73093 40 2698.27385 41 165.27183 42 1392.86779 43 1633.01678 44 1458.00869 45 2264.26172 46 -518.64838 47 2353.89454 48 -218.95647 49 -1851.00142 50 1250.14757 51 1356.80465 52 47.52082 53 -1823.32413 54 -2457.81806 55 -1837.71604 56 648.04710 57 -894.10391 58 -1050.84481 59 1707.86327 60 564.62035 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1e8cs1257152151.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/2wzhp1257152151.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/3zo271257152151.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/4y58z1257152151.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/5yz0t1257152151.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/69f3o1257152151.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/77xcv1257152151.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/8ok1u1257152151.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. -1.700 1.800 2.300 2.457 2.825 5.900 > > #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/94jy41257152151.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/102nvr1257152151.tab") > > system("convert tmp/1e8cs1257152151.ps tmp/1e8cs1257152151.png") > system("convert tmp/2wzhp1257152151.ps tmp/2wzhp1257152151.png") > system("convert tmp/3zo271257152151.ps tmp/3zo271257152151.png") > system("convert tmp/4y58z1257152151.ps tmp/4y58z1257152151.png") > system("convert tmp/5yz0t1257152151.ps tmp/5yz0t1257152151.png") > system("convert tmp/69f3o1257152151.ps tmp/69f3o1257152151.png") > system("convert tmp/77xcv1257152151.ps tmp/77xcv1257152151.png") > system("convert tmp/8ok1u1257152151.ps tmp/8ok1u1257152151.png") > > > proc.time() user system elapsed 1.594 1.168 4.177