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(99,98.6,98.6,98.5,98.9,99.4,99.8,99.9,100,100.1,100.1,100.2,100.3,100,99.9,99.4,99.8,99.6,100,99.9,100.3,100.6,100.7,100.8,100.8,100.6,101.1,101.1,100.9,101.1,101.2,101.4,101.9,102.1,102.1,103,103.4,103.2,103.1,103,103.7,103.4,103.5,103.8,104,104.2,104.4,104.4,104.9,105.3,105.2,105.4,105.4,105.5,105.7,105.6,105.8,105.4,105.5,105.8,106.1,106,105.5,105.4,106,106.1,106.4,106,106,106,106,106.1,106.1) > x <- c(8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8,8,7.7,7.3,7.4,8.1,8.3,8.2) > 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 -2.508901390 2 -2.908901390 3 -2.908901390 4 -2.490824430 5 -1.313708991 6 -1.072747471 7 -1.967939870 8 -3.940247707 9 -4.617363146 10 -3.999286187 11 -0.372747471 12 1.022444928 13 1.122444928 14 -0.731785951 15 -2.126978349 16 -2.367939870 17 -1.449862910 18 -1.390824430 19 -1.249862910 20 -2.126978349 21 -1.986016829 22 -2.204093788 23 -0.290824430 24 0.068214049 25 0.068214049 26 -0.649862910 27 -0.408901390 28 -0.149862910 29 0.168214049 30 0.368214049 31 0.209175570 32 0.150137090 33 0.132060130 34 -0.445055309 35 0.073021651 36 0.713983171 37 1.113983171 38 0.654944691 39 0.295906212 40 0.195906212 41 1.154944691 42 0.854944691 43 0.695906212 44 1.254944691 45 0.677829252 46 -0.417363146 47 0.559752293 48 0.041675333 49 -0.235440106 50 0.164559894 51 0.064559894 52 0.782636854 53 1.041675333 54 0.623598374 55 0.046482935 56 -1.089670984 57 -1.666786423 58 -1.030632504 59 2.177829252 60 2.995906212 61 2.259752293 62 0.605521414 63 -0.671594025 64 0.005521414 65 2.677829252 66 3.554944691 67 3.854944691 68 2.677829252 69 1.641675333 70 1.900713813 71 3.713983171 72 4.332060130 73 4.073021651 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1atkc1257603554.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/268da1257603554.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/3l7ov1257603554.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/438o91257603554.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/5ivpg1257603554.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/6ymnv1257603554.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/79nr11257603554.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/8shy21257603554.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.10 7.40 8.00 7.93 8.50 9.30 > > #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/9zes31257603554.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/10drkt1257603554.tab") > > system("convert tmp/1atkc1257603554.ps tmp/1atkc1257603554.png") > system("convert tmp/268da1257603554.ps tmp/268da1257603554.png") > system("convert tmp/3l7ov1257603554.ps tmp/3l7ov1257603554.png") > system("convert tmp/438o91257603554.ps tmp/438o91257603554.png") > system("convert tmp/5ivpg1257603554.ps tmp/5ivpg1257603554.png") > system("convert tmp/6ymnv1257603554.ps tmp/6ymnv1257603554.png") > system("convert tmp/79nr11257603554.ps tmp/79nr11257603554.png") > system("convert tmp/8shy21257603554.ps tmp/8shy21257603554.png") > > > proc.time() user system elapsed 1.648 1.188 2.407