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(10001.60,10411.75,10673.38,10539.51,10723.78,10682.06,10283.19,10377.18,10486.64,10545.38,10554.27,10532.54,10324.31,10695.25,10827.81,10872.48,10971.19,11145.65,11234.68,11333.88,10997.97,11036.89,11257.35,11533.59,11963.12,12185.15,12377.62,12512.89,12631.48,12268.53,12754.80,13407.75,13480.21,13673.28,13239.71,13557.69,13901.28,13200.58,13406.97,12538.12,12419.57,12193.88,12656.63,12812.48,12056.67,11322.38,11530.75,11114.08,9181.73,8614.55,8595.56,8396.20,7690.50,7235.47,7992.12,8398.37,8593.01,8679.75,9374.63,9634.97) > x <- c(7.921811356,7.9548181,7.979831924,8.000299192,8.03287317,8.041161832,8.045367102,8.026581875,8.038289272,8.058861974,8.088610929,8.0946867,8.100258559,8.120883048,8.158851144,8.207137349,8.246187295,8.273326389,8.267579887,8.243035254,8.180354488,8.216523139,8.259010373,8.286546562,8.328093515,8.342780279,8.36424945,8.399289899,8.41241917,8.379534436,8.431911953,8.45467077,8.438452968,8.425700516,8.343439624,8.365553689,8.397334754,8.32000487,8.322802292,8.254396233,8.221742353,8.209145133,8.257805692,8.243035254,8.16176604,8.017175616,8.021922625,7.993734776,7.695221239,7.608101484,7.529852116,7.552452488,7.501628936,7.420620821,7.530716019,7.626579953,7.615594008,7.635704772,7.737795072,7.801092585) > 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 -155.80423 2 73.61026 3 198.27171 4 -47.67121 5 -41.76702 6 -128.87336 7 -550.77022 8 -353.91768 9 -308.56404 10 -362.47429 11 -516.48107 12 -571.48026 13 -810.22017 14 -552.21398 15 -627.55644 16 -847.28791 17 -962.40427 18 -936.55020 19 -816.05399 20 -582.45459 21 -575.14261 22 -734.27182 23 -746.45978 24 -621.00009 25 -418.96934 26 -277.35987 27 -202.44892 28 -259.05042 29 -212.35256 30 -395.23514 31 -195.76947 32 332.55974 33 493.82380 34 756.72258 35 773.58974 36 970.47944 37 1140.04540 38 862.78177 39 1053.85388 40 559.57593 41 619.82926 42 463.11804 43 659.41671 44 896.14541 45 585.34242 46 642.78831 47 825.16504 48 562.84366 49 265.06857 50 174.93147 51 584.41267 52 261.29949 53 -166.10525 54 -177.55794 55 -23.75781 56 -142.43135 57 112.36455 58 88.98375 59 224.84641 60 138.58730 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1j9vz1257283553.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/2mv701257283553.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/3s28w1257283553.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/48bvo1257283553.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/5u4ms1257283553.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/6og6h1257283553.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/7zlth1257283553.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/8plqf1257283553.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.421 7.990 8.160 8.087 8.295 8.455 > > #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/9s0gr1257283553.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/10kufa1257283553.tab") > > system("convert tmp/1j9vz1257283553.ps tmp/1j9vz1257283553.png") > system("convert tmp/2mv701257283553.ps tmp/2mv701257283553.png") > system("convert tmp/3s28w1257283553.ps tmp/3s28w1257283553.png") > system("convert tmp/48bvo1257283553.ps tmp/48bvo1257283553.png") > system("convert tmp/5u4ms1257283553.ps tmp/5u4ms1257283553.png") > system("convert tmp/6og6h1257283553.ps tmp/6og6h1257283553.png") > system("convert tmp/7zlth1257283553.ps tmp/7zlth1257283553.png") > system("convert tmp/8plqf1257283553.ps tmp/8plqf1257283553.png") > > > proc.time() user system elapsed 1.573 1.175 1.945