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(-104.3228528,-171.3642244,-215.7228662,-133.9699868,-26.58093072,-258.1265975,-32.55203117,-94.68086414,41.89234377,-19.77428408,-18.40388067,44.62190258,-129.5594216,-50.96458948,-57.05684599,-17.93134275,27.22535774,-22.36155521,22.42601226,14.67274586,193.4889668,-141.7736931,100.1066106,-6.800489974,-103.3154616,-44.07404359,-91.14577152,167.5350613,90.87928764,59.18225146,-16.60445579,-47.64312038,100.7602759,59.1304689,235.5742541,72.38114038,76.37033171,-183.5795384,9.513535843,171.4591524,34.29768769,-121.3369608,-157.0214099,-322.7057413,9.850056448,72.29444983,95.86798799,249.1312608,289.0220777,89.91889362,423.6310857,182.9835906,144.8472988,319.6374419,-101.2462938,-46.42156961,30.06393293,-236.7016685,-303.3694895,-151.653482) > x <- c(-43.46299021,-80.75309516,-70.74336158,38.9668564,103.8074054,-154.6120618,80.77812389,-8.071755014,98.25849525,-30.58100421,-44.78092348,40.3791734,-132.19098,-76.88100421,-106.2410204,-60.55099614,-2.200632843,-67.52066514,-28.0902534,-21.31993855,204.9200453,-150.9996641,90.49044089,3.190198694,-95.23997084,-53.65976094,-80.03964792,206.0103925,95.62085262,70.15086069,-4.308751793,-9.298856744,138.9711352,77.72149848,281.4313935,108.1314743,118.3119264,-143.9872663,73.21297587,215.4333311,67.37396079,-107.8253934,-100.1751915,-279.1043923,25.05610826,71.32658458,126.5560275,225.3961728,229.2960114,-32.31452952,256.6652767,74.69536553,8.935672307,161.5151556,-242.1946587,-173.2347233,-53.46489282,-290.1749493,-360.6546748,-187.924909) > 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 -63.1637686 2 -94.8917262 3 -148.7295010 4 -170.8712703 5 -124.8856658 6 -111.7102825 7 -109.0482314 8 -87.0369804 9 -51.1576203 10 9.1856683 11 24.0032752 12 6.3831668 13 -4.3756814 14 21.8410714 15 43.5525019 16 39.4099385 17 29.3093384 18 41.5799437 19 49.0272447 20 34.8625474 21 -0.5685832 22 1.2217119 23 14.4129283 24 -9.8215812 25 -13.1240146 26 6.7412962 27 -15.3489018 28 -27.5550383 29 0.3271488 30 -7.2500204 31 -12.5241043 32 -38.8371817 33 -30.8442139 34 -14.4711329 35 -30.9388956 36 -30.0184514 37 -35.6700621 38 -47.2248149 39 -59.8185332 40 -32.5543903 41 -29.5048834 42 -19.2272251 43 -62.1563507 44 -58.3962421 45 -13.8778662 46 4.7487774 47 -23.9794998 48 35.6829912 49 71.8806940 50 120.5204798 51 180.5712392 52 112.2477111 53 136.3852927 54 166.6839554 55 128.1099998 56 117.6302484 57 80.6947343 58 38.0915546 59 38.1674376 60 26.3098176 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1mohd1257194312.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/2t0b51257194312.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/3ejoq1257194312.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/497gm1257194312.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/5vh231257194312.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/62bgz1257194312.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/7wgox1257194312.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/836zw1257194312.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. -3.607e+02 -8.022e+01 -6.190e+00 -1.050e-09 9.177e+01 2.814e+02 > > #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/99i641257194312.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/106rk91257194312.tab") > > system("convert tmp/1mohd1257194312.ps tmp/1mohd1257194312.png") > system("convert tmp/2t0b51257194312.ps tmp/2t0b51257194312.png") > system("convert tmp/3ejoq1257194312.ps tmp/3ejoq1257194312.png") > system("convert tmp/497gm1257194312.ps tmp/497gm1257194312.png") > system("convert tmp/5vh231257194312.ps tmp/5vh231257194312.png") > system("convert tmp/62bgz1257194312.ps tmp/62bgz1257194312.png") > system("convert tmp/7wgox1257194312.ps tmp/7wgox1257194312.png") > system("convert tmp/836zw1257194312.ps tmp/836zw1257194312.png") > > > proc.time() user system elapsed 2.596 1.935 3.014