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(453.76,567.15,-1861.46,-7454.68,-11242.01,-11289.29,11715.62,19336.27,20729.84,17062.92,10369.32,11258.72,10721.21,10375.43,8202.51,2834.34,-371.69,-2429.58,19711.67,23745.59,25554.61,21797.03,15266.24,16605.63,14210.92,14714.05,11338.08,10074.50,9246.14,6347.71,25088.21,25798.35,27194.14,13649.64,4755.79,1004.64,4035.07,-1054.60,-10228.63,-11699.39,-18817.18,-29199.23,-6246.90,-4201.96,-10585.42,-15033.13,-22236.31,-18963.19,-17206.41,-20744.05,-28649.59,-29339.61,-40442.91,-39478.68,-18740.10,-18252.00,-20542.69,-23465.13,-23725.81,-15453.46,-6685.61,-3334.80,1292.91,2637.62,-3574.61,1701.23,22560.80,26551.57,24040.85) > x <- c(-2.225348423,2.257563984,1.740476391,3.706301205,7.959396904,-1.810786388,-1.764228405,-1.270419804,4.26994678,0.614671842,1.706301205,4.797930568,6.99357209,2.027747276,-1.627527662,-3.076264883,-0.444268937,1.268460179,1.670639417,3.325914355,4.085201453,1.936117913,-4.638423857,-9.15551145,-2.385328158,-1.30459499,-5.936590936,-15.08567448,-11.20058283,-4.660216246,-1.464574724,-3.7751246,-3.20058283,-10.00494131,-3.315491184,-1.004941308,3.454692108,3.201596409,6.833592356,4.627054639,6.052512869,1.07579186,3.822696161,2.086688055,-1.740949414,-0.362049167,2.580496656,5.901942727,4.867767541,-0.017324105,3.810313364,4.051026267,0.672126019,-0.293698795,1.855384745,-1.43188614,-3.444268937,3.945527506,3.541861665,7.506199877,0.816749754,1.000008479,-1.770174813,-9.549075061,-2.783250246,-4.981417326,-1.341050742,0.916057116,-3.913759591) > 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 -2369.1345 2 3430.9114 3 346.3664 4 -2753.1690 5 -1145.3698 6 -13586.3050 7 9477.6646 8 17724.7198 9 26146.3456 10 17842.6429 11 12533.7946 12 17344.9827 13 19592.6839 14 12947.6647 15 6137.9620 16 -1067.9575 17 -935.2528 18 -820.5147 19 21830.9069 20 27964.5733 21 30736.7628 22 24253.0312 23 9382.3154 24 4991.6976 25 11185.0883 26 13059.1480 27 3807.4068 28 -9061.9521 29 -4962.0027 30 436.1413 31 23230.3707 32 21009.5362 33 23134.1429 34 958.1903 35 550.0295 36 -270.1459 37 8417.4102 38 3006.6837 39 -1560.0933 40 -5829.8866 41 -11139.4569 42 -27834.5680 43 -1397.7399 44 -1554.9578 45 -12793.8456 46 -15492.3955 47 -18962.9026 48 -11476.4678 49 -11031.5579 50 -20766.0255 51 -23816.1377 52 -24200.8090 53 -39590.3055 54 -39851.2418 55 -16386.5103 56 -20068.3732 57 -24911.8074 58 -18460.1561 59 -19232.8936 60 -5931.7084 61 -5649.5476 62 -2066.2706 63 -952.5885 64 -9475.5550 65 -7105.2131 66 -4617.7881 67 20859.6532 68 27713.6056 69 19076.1752 > library(lattice) > postscript(file="/var/www/rcomp/tmp/11ulp1257368247.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/2ftuy1257368247.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/38mqc1257368247.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/4ldnw1257368247.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/57u6g1257368247.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/61gg41257368247.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/7800d1257368247.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/8e2e01257368247.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. -1.509e+01 -2.225e+00 6.721e-01 -1.014e-10 3.455e+00 7.959e+00 > > #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/9975c1257368247.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/10apcr1257368247.tab") > > system("convert tmp/11ulp1257368247.ps tmp/11ulp1257368247.png") > system("convert tmp/2ftuy1257368247.ps tmp/2ftuy1257368247.png") > system("convert tmp/38mqc1257368247.ps tmp/38mqc1257368247.png") > system("convert tmp/4ldnw1257368247.ps tmp/4ldnw1257368247.png") > system("convert tmp/57u6g1257368247.ps tmp/57u6g1257368247.png") > system("convert tmp/61gg41257368247.ps tmp/61gg41257368247.png") > system("convert tmp/7800d1257368247.ps tmp/7800d1257368247.png") > system("convert tmp/8e2e01257368247.ps tmp/8e2e01257368247.png") > > > proc.time() user system elapsed 2.090 1.930 3.535