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(-1.069110747,-0.224600155,-0.519176561,-0.443841916,-0.891681921,-1.156458458,-1.006923284,-0.875826413,-0.540297967,0.171800008,0.591873748,0.389981437,0.673187551,1.247849664,0.778924303,0.678994652,0.484846026,-0.005963015,-0.059886436,0.354323765,-0.043744137,-2.324150774,-0.742260114,-0.928757841,0.452743329,0.698858699,1.179755043,1.546243351,-0.10570001,-0.32691026,0.362464223,0.651949789,0.551157845,0.446572065,0.494726378,0.755766464,1.09262198,0.863112479,0.364138006,0.637611953,0.988913294,-0.167260062,-0.154025582,-0.096528058,-0.45853115,-1.333579753,0.209242602,0.691360013,0.845796569,0.714135402,1.718736881,1.594872844,-2.013866339,-1.988010127,-1.266473304,-0.471055044,-0.459380319,-0.626904673,-1.931655944) > x <- c(0.111303201,-0.371599129,-0.544498244,-0.672144477,-0.278753982,0.180265125,-0.223157237,-0.647930439,-0.115006714,0.474009056,0.444049469,0.142263723,-0.398007085,-0.306412935,0.14022632,-0.16357871,-0.355567414,-0.766507955,-0.723356535,-0.540373189,-0.442800262,-0.362274443,-0.506612614,-0.470776921,-0.671769894,-0.481586013,-0.435223289,-0.450030542,-0.28629111,-0.209552142,-0.233453609,-0.73921599,-0.789934939,-0.696006808,-0.694917718,-0.26050412,0.7801581,1.288611235,1.378888341,1.548015642,1.701326595,2.464384664,2.03982207,2.429835942,3.002296814,3.843909989,3.166523773,2.881455087,2.132925623,0.469808508,-0.58023403,-0.853988559,-0.448632611,-1.497842086,-1.275860125,-2.067516339,-3.015816436,-3.441007126,-3.601337506) > 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 -1.08350860 2 -0.17653119 3 -0.44874187 4 -0.35689529 5 -0.85562313 6 -1.17977702 7 -0.97805632 8 -0.79201204 9 -0.52542104 10 0.11048359 11 0.53443282 12 0.37157862 13 0.72467257 14 1.28748634 15 0.76078504 16 0.70015471 17 0.53084118 18 0.09319019 19 0.03368483 20 0.42422485 21 0.01353520 22 -2.27728802 23 -0.67672620 24 -0.86785953 25 0.53964150 26 0.76115525 27 1.23605424 28 1.60445798 29 -0.06866624 30 -0.29980321 31 0.39266309 32 0.74757259 33 0.65334150 34 0.53660545 35 0.58461889 36 0.78946451 37 0.99170303 38 0.69642153 39 0.18576907 40 0.43736521 41 0.76883470 42 -0.48604560 43 -0.41789095 44 -0.41084447 45 -0.84689942 46 -1.83081662 47 -0.20036958 48 0.31862348 49 0.56988760 50 0.65336236 51 1.79379424 52 1.70534229 53 -1.95583255 54 -1.79425369 55 -1.10143180 56 -0.20360722 57 -0.06926319 58 -0.18178613 59 -1.46579754 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/14arx1256843332.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/2pzc61256843332.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/3uxwo1256843332.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/4jw901256843332.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/5kwv21256843332.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/6qcnj1256843332.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/7xsb01256843332.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/8nlc71256843332.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.601e+00 -6.599e-01 -3.556e-01 1.301e-18 4.569e-01 3.844e+00 > > #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/9gb6j1256843332.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/10d4or1256843332.tab") > > system("convert tmp/14arx1256843332.ps tmp/14arx1256843332.png") > system("convert tmp/2pzc61256843332.ps tmp/2pzc61256843332.png") > system("convert tmp/3uxwo1256843332.ps tmp/3uxwo1256843332.png") > system("convert tmp/4jw901256843332.ps tmp/4jw901256843332.png") > system("convert tmp/5kwv21256843332.ps tmp/5kwv21256843332.png") > system("convert tmp/6qcnj1256843332.ps tmp/6qcnj1256843332.png") > system("convert tmp/7xsb01256843332.ps tmp/7xsb01256843332.png") > system("convert tmp/8nlc71256843332.ps tmp/8nlc71256843332.png") > > > proc.time() user system elapsed 1.561 1.142 2.192