R version 2.8.1 (2008-12-22) 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(523.5658454,-3273.146241,-10414.07811,-6902.790198,-2897.146241,-4727.214371,-8504.926458,-9664.078111,-9522.585808,-11281.65394,11711.70211,18606.99002,18669.27793,20458.48232,12320.41419,11765.34606,10978.34606,12736.41419,13642.19441,6972.126279,2179.058149,2409.482322,25864.19441,29791.19441,31499.55045,23225.05815,17110.41419,20072.48232,15823.41419,14852.70211,7120.209802,7283.277932,7607.990019,2783.921889,19491.85376,20415.85376,19612.42959,5818.429585,-1078.502285,-4449.146241,-681.7901979,-4945.434155,-13923.43415,-15768.43415,-26036.21437,-36721.21437,-12942.85833,-12288.92646,-16241.50228,-16101.00998,-19161.51768,-14289.80559,-10476.38142,-13384.02537,-16588.17703,-17771.88911,-23359.32868,-18508.19242,3181.163623,608.3834059,-161.2605507,-6787.108898,-15131.80559,-8601.585808,-1830.653938,-180.0781112,-3207.706675,-2290.706675,-14767.26711,-14364.75941,2786.104328,11306.30872) > x <- c(14836.78129,4363.00051,-4002.328314,-1812.109098,848.00051,-1406.670666,-4893.45145,-8497.328314,-9477.095569,-4271.766746,24414.12365,33009.34286,33054.56208,37817.57561,26184.90443,25413.23325,21611.23325,20980.90443,19480.35639,12208.68521,8744.014038,13570.57561,43565.35639,47787.35639,46298.24678,32359.01404,22631.90443,24020.57561,21922.90443,17815.12365,9175.890902,6032.562078,6020.342862,8397.671686,35701.00051,41019.00051,32444.43894,13947.43894,1575.110118,-2650.99949,-2245.109098,-8832.218706,-17035.21871,-20944.21871,-29913.67067,-31604.67067,2188.219726,8149.54855,-7346.889882,-15975.65714,-24040.42439,-22757.64361,-20422.08204,-26004.19165,-30769.06851,-33706.8493,-40292.94538,-31693.60302,-1712.712632,1714.835408,-12289.2742,-24404.39734,-34307.64361,-30919.09557,-28222.76675,-28942.32831,-33556.90341,-34260.90341,-43434.80733,-37319.04008,-9341.382428,3.631100644) > 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 -7307.05019 2 -5575.86818 3 -8301.71319 4 -5946.38798 5 -3344.70736 6 -3984.79608 7 -5922.24099 8 -5179.32404 9 -4520.72624 10 -9027.08373 11 -1173.68215 12 1185.18644 13 1223.60837 14 498.97034 15 -1499.55986 16 -1647.35227 17 -427.71744 18 1663.02817 19 3360.77366 20 528.57735 21 -2435.89271 22 -4752.85059 23 2871.09560 24 4569.79148 25 7064.07578 26 6146.48773 27 5165.65675 28 7394.80643 29 4252.85562 30 5450.16458 31 2277.32124 32 4099.38808 33 4430.54928 34 -1648.23501 35 649.43629 36 -1233.31911 37 2488.77327 38 -1542.80577 39 -1909.82023 40 -3049.99108 41 503.14250 42 -283.93029 43 -4932.51799 44 -4714.41026 45 -10248.25710 46 -20040.77432 47 -14097.76573 48 -16590.12793 49 -12363.93122 50 -7669.31348 51 -6473.36592 52 -2278.68502 53 302.06708 54 340.57136 55 -348.75445 56 18.04722 57 -2093.35610 58 -1780.81530 59 4085.10598 60 -296.67932 61 6324.82195 62 6093.14197 63 2975.22037 64 7717.01866 65 13064.87127 66 15095.22019 67 14503.09061 68 15791.65056 69 8156.92999 70 5331.63348 71 7716.33667 72 11304.39228 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1km2k1257362827.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/rcomp/tmp/2icjq1257362827.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/rcomp/tmp/3dfxe1257362827.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/rcomp/tmp/4ai1f1257362827.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/rcomp/tmp/5gqw51257362827.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/rcomp/tmp/62q9x1257362827.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/rcomp/tmp/701e01257362827.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/rcomp/tmp/878ek1257362827.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. -4.343e+04 -2.140e+04 -7.015e+02 -4.772e-07 1.986e+04 4.779e+04 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9s0nd1257362827.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/rcomp/tmp/10glec1257362827.tab") > > system("convert tmp/1km2k1257362827.ps tmp/1km2k1257362827.png") > system("convert tmp/2icjq1257362827.ps tmp/2icjq1257362827.png") > system("convert tmp/3dfxe1257362827.ps tmp/3dfxe1257362827.png") > system("convert tmp/4ai1f1257362827.ps tmp/4ai1f1257362827.png") > system("convert tmp/5gqw51257362827.ps tmp/5gqw51257362827.png") > system("convert tmp/62q9x1257362827.ps tmp/62q9x1257362827.png") > system("convert tmp/701e01257362827.ps tmp/701e01257362827.png") > system("convert tmp/878ek1257362827.ps tmp/878ek1257362827.png") > > > proc.time() user system elapsed 1.950 1.690 3.473