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(29.837,29.571,30.167,30.524,30.996,31.033,31.198,30.937,31.649,33.115,34.106,33.926,33.382,32.851,32.948,36.112,36.113,35.21,35.193,34.383,35.349,37.058,38.076,36.63,36.045,35.638,35.114,35.465,35.254,35.299,35.916,36.683,37.288,38.536,38.977,36.407,34.955,34.951,32.68,34.791,34.178,35.213,34.871,35.299,35.443,37.108,36.419,34.471,33.868,34.385,33.643,34.627,32.919,35.5,36.11,37.086,37.711,40.427,39.884,38.512,38.767) > x <- c(4.04,3.91,3.78,3.59,3.53,3.49,3.67,3.54,3.36,3.19,3.22,3.24,3.08,3.25,3.45,3.36,3.33,3.49,3.67,3.95,4.01,4.01,4.04,3.92,3.8,3.84,3.77,3.83,4.06,4.1,4.01,4.24,4.36,4.64,4.62,4.44,4.4,4.42,4.29,4.42,4.25,4.15,4.14,4.39,4.53,4.84,4.86,4.57,4.57,4.44,4.2,3.84,4.04,4.06,4.01,3.9,3.93,4.03,3.78,3.62,3.6) > 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 -5.25507626 2 -5.28174329 3 -4.44641033 4 -3.73961599 5 -3.15715462 6 -3.04651371 7 -3.21289782 8 -3.23456485 9 -2.19118075 10 -0.41220687 11 0.52356245 12 0.30674199 13 0.05730564 14 -0.78666824 15 -1.05787280 16 2.27181925 17 2.32804994 18 1.13048629 19 0.78210218 20 -0.54338420 21 0.31215443 22 2.02115443 23 2.98392374 24 1.75884648 25 1.39476922 26 0.91412831 27 0.51899990 28 0.75953853 29 0.12510329 30 0.09646238 31 0.87915443 32 1.22271918 33 1.60679645 34 2.33931006 35 2.81713052 36 0.57851462 37 -0.79984447 38 -0.84066492 39 -2.87233196 40 -1.00066492 41 -1.30069104 42 -0.08158876 43 -0.40517854 44 -0.43743424 45 -0.55117743 46 0.54310550 47 -0.18271496 48 -1.59681834 49 -2.19981834 50 -1.44348538 51 -1.74363990 52 -0.09687169 53 -2.17307626 54 0.37110329 55 1.07315443 56 2.25166694 57 2.82143625 58 5.35333397 59 5.27058967 60 4.19315332 61 4.48497378 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/19lzd1257268961.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/2mqmm1257268961.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/38c611257268961.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/415w51257268961.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/5emzb1257268961.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/6ggcc1257268961.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/7gkin1257268961.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/80wsf1257268961.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. 3.080 3.620 4.010 3.953 4.250 4.860 > > #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/943qq1257268961.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/10cis41257268961.tab") > > system("convert tmp/19lzd1257268961.ps tmp/19lzd1257268961.png") > system("convert tmp/2mqmm1257268961.ps tmp/2mqmm1257268961.png") > system("convert tmp/38c611257268961.ps tmp/38c611257268961.png") > system("convert tmp/415w51257268961.ps tmp/415w51257268961.png") > system("convert tmp/5emzb1257268961.ps tmp/5emzb1257268961.png") > system("convert tmp/6ggcc1257268961.ps tmp/6ggcc1257268961.png") > system("convert tmp/7gkin1257268961.ps tmp/7gkin1257268961.png") > system("convert tmp/80wsf1257268961.ps tmp/80wsf1257268961.png") > > > proc.time() user system elapsed 2.533 1.880 2.920