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.62,4.64,4.57,4.49,4.48,4.5,4.52,4.63,4.75,4.99,5.28,5.33,5.26,5.14,4.99,4.85,4.83,4.83,4.88,4.91,4.93,4.93,4.95,4.95,4.88,4.78,4.61,4.46,4.42,4.43,4.41,4.4,4.36,4.36,4.38,4.4,4.37,4.32,4.18,4.04,4,3.97,3.94,3.93,3.89,3.89,3.88,3.9,3.9,3.95,4.02,4.07,4.17,4.27,4.32,4.38,4.45,4.71,4.96,4.95,4.78,4.78,4.68,4.65,4.64,4.74,4.76,4.61,4.75,4.73,4.68,4.68,4.75,4.79,4.81,4.92,4.99,5.18,5.29,5.48,5.66) > x <- c(2.97,3.04,3.12,3.21,3.34,3.45,3.74,4.02,4.24,4.87,5.62,6.02,5.98,5.89,5.76,5.58,5.39,5.19,5.16,5.2,5.25,5.26,5.21,5.18,5.13,5.03,5.01,4.87,4.86,4.82,4.69,4.65,4.61,4.47,4.37,4.29,4.2,4.19,4.09,3.88,3.87,3.74,3.61,3.43,3.29,3.18,3.07,3.02,2.97,2.98,3.01,3.06,3.12,3.16,3.19,3.21,3.27,3.36,3.45,3.52,3.58,3.62,3.5,3.43,3.41,3.48,3.63,3.76,3.8,3.72,3.67,3.58,3.47,3.43,3.55,3.65,3.7,3.7,3.93,4.15,4.24) > 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.282238462 2 0.285022468 3 0.195347047 4 0.093212198 5 0.051239638 6 0.044185934 7 -0.007137468 8 0.033998558 9 0.099891149 10 0.184947207 11 0.290490133 12 0.242113026 13 0.181950737 14 0.084085586 15 -0.033941855 16 -0.129672157 17 -0.102943031 18 -0.053754478 19 0.003623805 20 0.023786094 21 0.031488956 22 0.029029528 23 0.061326667 24 0.068704950 25 0.011002088 26 -0.064403636 27 -0.229484780 28 -0.345052793 29 -0.382593365 30 -0.362755655 31 -0.350783095 32 -0.350945385 33 -0.381107674 34 -0.346675687 35 -0.302081410 36 -0.262405989 37 -0.270271140 38 -0.317811712 39 -0.433217436 40 -0.521569455 41 -0.559110027 42 -0.557137468 43 -0.555164908 44 -0.520895210 45 -0.526463223 46 -0.499409519 47 -0.482355815 48 -0.450058677 49 -0.437761538 50 -0.390220966 51 -0.327599249 52 -0.289896387 53 -0.204652953 54 -0.114490664 55 -0.071868947 56 -0.016787802 57 0.038455632 58 0.276320783 59 0.504185934 60 0.476969941 61 0.292213375 62 0.282375664 63 0.211888796 64 0.199104790 65 0.194023645 66 0.276807651 67 0.259916236 68 0.077943677 69 0.208105966 70 0.207781387 71 0.170078526 72 0.192213375 73 0.289267079 74 0.339104790 75 0.329591658 76 0.414997381 77 0.472700243 78 0.662700243 79 0.716133407 80 0.852025998 81 1.009891149 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/17niu1258035377.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/2vd5b1258035377.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/3m9iw1258035377.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/46eu01258035377.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/5j9de1258035377.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/6k5ar1258035377.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/72ubt1258035377.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/8j42h1258035377.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. 2.970 3.430 3.740 4.054 4.820 6.020 > > #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/98p1h1258035377.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/100u471258035377.tab") > > system("convert tmp/17niu1258035377.ps tmp/17niu1258035377.png") > system("convert tmp/2vd5b1258035377.ps tmp/2vd5b1258035377.png") > system("convert tmp/3m9iw1258035377.ps tmp/3m9iw1258035377.png") > system("convert tmp/46eu01258035377.ps tmp/46eu01258035377.png") > system("convert tmp/5j9de1258035377.ps tmp/5j9de1258035377.png") > system("convert tmp/6k5ar1258035377.ps tmp/6k5ar1258035377.png") > system("convert tmp/72ubt1258035377.ps tmp/72ubt1258035377.png") > system("convert tmp/8j42h1258035377.ps tmp/8j42h1258035377.png") > > > proc.time() user system elapsed 2.526 1.903 3.000