R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(4.411555097,4.458778163,4.455553545,4.436821354,4.415936395,4.426902003,4.31572122,4.355423385,4.401944451,4.38523274,4.36861206,4.34180472,4.336478646,4.420525934,4.438760167,4.429626805,4.435719049,4.43791299,4.337949347,4.348761949,4.387816093,4.403370965,4.395895022,4.370612996,4.413267274,4.467345017,4.491843581,4.480787672,4.493961492,4.480009376,4.404962828,4.419775111,4.46760438,4.507694062,4.497161723,4.481715849,4.513979908,4.544032808,4.583206746,4.572799875,4.578126787,4.590373249,4.512729186,4.51491063,4.559574315,4.58165895,4.582045868,4.56793031,4.605420155,4.62849308,4.655901322,4.629195259,4.639311676,4.64601842,4.538802793,4.596363521,4.639130936,4.661052286,4.646956835,4.635724609) > x <- c(4.485522538,4.521180784,4.473286578,4.525422185,4.462968169,4.50528797,4.500316209,4.50293589,4.561950528,4.546146033,4.529338267,4.480770685,4.524632356,4.557694857,4.584483688,4.559719789,4.545574098,4.54993545,4.508709945,4.512581101,4.51074961,4.535418098,4.529356606,4.467497659,4.552154356,4.598887491,4.593544873,4.586388917,4.569782358,4.604711081,4.5307397,4.569119084,4.597968315,4.580112857,4.586821881,4.583224123,4.595698471,4.661178995,4.658315614,4.680927725,4.677995836,4.646548186,4.618303564,4.608533524,4.672255773,4.682767136,4.664626125,4.662495253,4.69831803,4.717096996,4.707347641,4.688474032,4.667899885,4.655375539,4.594142605,4.618693335,4.675406817,4.651047541,4.665401319,4.618322316) > 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 0.0518293066 2 0.0535979206 3 0.1114252368 4 0.0262344924 5 0.0849612190 6 0.0419807254 7 -0.0628624303 8 -0.0264996378 9 -0.0552059968 10 -0.0517713254 11 -0.0469667286 12 -0.0118637653 13 -0.0731014009 14 -0.0311997043 15 -0.0471138596 16 -0.0246800644 17 -0.0005559567 18 -0.0039215394 19 -0.0513340071 20 -0.0454560638 21 -0.0040672728 22 -0.0199579352 23 -0.0197071438 24 0.0338639666 25 -0.0313957500 26 -0.0368898951 27 -0.0055809632 28 -0.0075149973 29 0.0268276159 30 -0.0316490109 31 -0.0124024020 32 -0.0465132732 33 -0.0354588356 34 0.0273916422 35 0.0083071437 36 -0.0025525788 37 0.0138101189 38 -0.0396066316 39 0.0032173293 40 -0.0360137613 41 -0.0269494976 42 0.0253840651 43 -0.0162558767 44 -0.0016203200 45 -0.0381849687 46 -0.0294994292 47 -0.0059877139 48 -0.0173869964 49 -0.0255613351 50 -0.0264264246 51 0.0134095624 52 0.0107621577 53 0.0471049509 54 0.0697767899 55 0.0406163050 56 0.0668816076 57 0.0373549382 58 0.0903276625 59 0.0579350941 60 0.1067156427 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/14btb1257169459.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/freestat/rcomp/tmp/20zzs1257169459.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/freestat/rcomp/tmp/31b7h1257169459.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/freestat/rcomp/tmp/44p161257169459.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/freestat/rcomp/tmp/552h91257169459.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/freestat/rcomp/tmp/6n33s1257169459.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/freestat/rcomp/tmp/7g70m1257169459.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/freestat/rcomp/tmp/8z0u81257169459.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.463 4.529 4.585 4.587 4.656 4.717 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9z2kr1257169459.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/freestat/rcomp/tmp/10quhg1257169459.tab") > > system("convert tmp/14btb1257169459.ps tmp/14btb1257169459.png") > system("convert tmp/20zzs1257169459.ps tmp/20zzs1257169459.png") > system("convert tmp/31b7h1257169459.ps tmp/31b7h1257169459.png") > system("convert tmp/44p161257169459.ps tmp/44p161257169459.png") > system("convert tmp/552h91257169459.ps tmp/552h91257169459.png") > system("convert tmp/6n33s1257169459.ps tmp/6n33s1257169459.png") > system("convert tmp/7g70m1257169459.ps tmp/7g70m1257169459.png") > system("convert tmp/8z0u81257169459.ps tmp/8z0u81257169459.png") > > > proc.time() user system elapsed 2.645 1.990 3.409