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(1.351,2.218,2.461,3.028,4.784,4.975,4.607,6.249,4.809,3.157,1.91,2.228,1.594,2.467,2.222,3.607,4.685,4.962,5.77,5.48,5,3.228,1.993,2.288,1.58,2.111,2.192,3.601,4.665,4.876,5.813,5.589,5.331,3.075,2.002,2.306,1.507,1.992,2.487,3.49,4.647,5.594,5.611,5.788,6.204,3.013,1.931,2.549,1.504,2.09,2.702,2.939,4.5,6.208,6.415,5.657,5.964,3.163,1.997,2.422) > x <- c(9.0,9.1,8.7,8.2,7.9,7.9,9.1,9.4,9.4,9.1,9.0,9.3,9.9,9.8,9.3,8.3,8.0,8.5,10.4,11.1,10.9,10.0,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9.0,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9.0,9.0,9.0,9.8,10.0,9.8,9.3,9.0,9.0,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.7,7.9,7.9,8.0) > 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.27425817 2 -1.41987593 3 -1.12640489 4 -0.49631608 5 1.29753720 6 1.48853720 7 0.96912407 8 2.57327078 9 1.13327078 10 -0.48087593 11 -1.71525817 12 -1.43511145 13 -2.14481802 14 -1.25920026 15 -1.44111145 16 0.07006616 17 1.18591944 18 1.39983063 19 1.96809317 20 1.58976885 21 1.13500437 22 -0.52343578 23 -1.65749369 24 -1.36249369 25 -2.10834698 26 -1.58996474 27 -1.49634698 28 -0.03687593 29 1.05235959 30 1.25074183 31 2.04894646 32 1.79971093 33 1.55432870 34 -0.62596474 35 -1.64849369 36 -1.35711145 37 -2.16872922 38 -1.68372922 39 -1.16349369 40 -0.13525817 41 1.02174183 42 1.96874183 43 1.88479974 44 2.03656422 45 2.47779974 46 -0.65011145 47 -1.69425817 48 -1.07625817 49 -2.13387593 50 -1.54787593 51 -0.93587593 52 -0.71149369 53 0.89997735 54 2.67106616 55 2.86544839 56 2.14530168 57 2.50277272 58 -0.32346280 59 -1.48946280 60 -1.07708056 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1r43d1259932531.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/2r4h11259932531.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/3zgyd1259932531.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/4mqdj1259932531.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/5dqsc1259932531.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/6af7j1259932531.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/71hrv1259932531.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/812711259932531.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. 7.700 8.875 9.100 9.142 9.500 11.100 > > #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/9u1eh1259932531.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/10zrbm1259932531.tab") > > system("convert tmp/1r43d1259932531.ps tmp/1r43d1259932531.png") > system("convert tmp/2r4h11259932531.ps tmp/2r4h11259932531.png") > system("convert tmp/3zgyd1259932531.ps tmp/3zgyd1259932531.png") > system("convert tmp/4mqdj1259932531.ps tmp/4mqdj1259932531.png") > system("convert tmp/5dqsc1259932531.ps tmp/5dqsc1259932531.png") > system("convert tmp/6af7j1259932531.ps tmp/6af7j1259932531.png") > system("convert tmp/71hrv1259932531.ps tmp/71hrv1259932531.png") > system("convert tmp/812711259932531.ps tmp/812711259932531.png") > > > proc.time() user system elapsed 1.630 1.198 2.074