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(423,427,441,449,452,462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409,412,406,398,397,385,390,413,413,401,397,397,409,419,424,428,430) > x <- c(4.736,4.754,5.030,5.088,5.081,5.004,4.934,4.905,4.868,4.844,4.804,4.762,4.718,4.727,5.004,5.056,5.056,4.990,4.920,4.883,4.828,4.812,4.762,4.736,4.710,4.718,4.970,5.011,5.004,4.898,4.812,4.754,4.762,4.710,4.654,4.625,4.554,4.533,4.820,4.868,4.820,4.745,4.663,4.654,4.654,4.615,4.554,4.533,4.431,4.466,4.754,4.787,4.762,4.691,4.654,4.673,4.691,4.691,4.682,4.673) > 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.7021390 2 -6.9956707 3 -28.1631574 4 -27.5534263 5 -23.6614973 6 -3.8502782 7 -1.9309881 8 7.7641463 9 12.4786283 10 17.5366706 11 21.6334078 12 20.9849818 13 25.5913928 14 25.4446269 15 6.1497218 16 -0.4760366 17 -1.4760366 18 0.9335798 19 3.8528699 20 14.5673518 21 24.5753655 22 25.6140603 23 27.9849818 24 28.2978610 25 33.6107402 26 31.5913928 27 14.4819484 28 9.2577928 29 5.1497218 30 0.6560754 31 1.6140603 32 8.0043293 33 8.9849818 34 9.6107402 35 5.7461723 36 6.4413068 37 7.4880153 38 0.1638023 39 -11.4052871 40 -14.5213717 41 -24.4052871 42 -20.8489048 43 -18.4005936 44 -12.2538277 45 -9.2538277 46 -10.2845089 47 -10.5119847 48 -8.8361977 49 -7.8395178 50 -7.2991629 51 -20.9956707 52 -25.2004789 53 -34.0150182 54 -28.9683096 55 -24.2538277 56 -14.6747779 57 -6.9683096 58 -1.9683096 59 3.1784562 60 6.3252221 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1uzuz1256744372.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/23uqx1256744372.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/3fh2l1256744372.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/4u7gj1256744372.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/584u01256744372.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/62tdb1256744372.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/7qp611256744372.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/837lo1256744372.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. 4.431 4.680 4.758 4.782 4.887 5.088 > > #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/9c8eg1256744372.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/10ewa81256744373.tab") > > system("convert tmp/1uzuz1256744372.ps tmp/1uzuz1256744372.png") > system("convert tmp/23uqx1256744372.ps tmp/23uqx1256744372.png") > system("convert tmp/3fh2l1256744372.ps tmp/3fh2l1256744372.png") > system("convert tmp/4u7gj1256744372.ps tmp/4u7gj1256744372.png") > system("convert tmp/584u01256744372.ps tmp/584u01256744372.png") > system("convert tmp/62tdb1256744372.ps tmp/62tdb1256744372.png") > system("convert tmp/7qp611256744372.ps tmp/7qp611256744372.png") > system("convert tmp/837lo1256744372.ps tmp/837lo1256744372.png") > > > proc.time() user system elapsed 1.574 1.146 2.196