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(-40844.25096,-39642.2792,-40387.28856,-39569.2418,-40148.79021,-39863.32829,-39214.02298,-37998.98205,-39201.05258,-41419.06871,-41419.37972,-38973.17654,-40015.01316,-39956.46282,-40836.73284,-40532.39319,-40936.02655,-42877.16523,-41299.49653,-40972.33476,-43876.26117,-46313.92341,-45101.62748,-48202.16992,-46874.10431,-46249.28511,-45528.49008,-45286.43675,-45660.00557,-45845.88583,-45957.86748,-45918.29858,-45496.07747,-45592.84717,-47339.05301,-47647.49435,-49806.96381,-48474.33669,-48058.90168,-46661.75709,-46475.99397,-46566.04365,-45282.92189,-40623.09239,-40500.54352,-45587.72861,-44493.85864,-42024.80743,-41966.23753,-41389.86007,-37635.1674,-37887.51141,-43418.43387,-45233.15894,-46915.80807,-48156.89717,-46639.67061,-47716.72199,-40342.78154) > 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.069176926 2 -0.224696603 3 -0.519254248 4 -0.443940204 5 -0.891765614 6 -1.156549340 7 -1.007030517 8 -0.875964245 9 -0.540405527 10 0.171748305 11 0.591822053 12 0.389868138 13 0.673100489 14 1.247761128 15 0.778857935 16 0.678920620 17 0.484782159 18 -0.005977998 19 -0.059941150 20 0.354260812 21 -0.043733960 22 -2.324079208 23 -0.742219078 24 -0.928638723 25 0.452829002 26 0.698928637 27 1.179806829 28 1.546289041 29 -0.105644912 30 -0.326850481 31 0.362526822 32 0.652011392 33 0.551208815 34 0.446625472 35 0.494823760 36 0.755871614 37 1.092781512 38 0.863238451 39 0.364253516 40 0.637692279 41 0.988988941 42 -0.167182147 43 -0.153979980 44 -0.096599806 45 -0.458605984 46 -1.333526475 47 0.209268333 48 0.691323565 49 0.845758646 50 0.714082964 51 1.718589887 52 1.594732205 53 -2.013867691 54 -1.987965778 55 -1.266386581 56 -0.470937066 57 -0.459300550 58 -0.626797780 59 -1.931734751 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1nnp81257797258.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/2zesk1257797258.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/3k5kq1257797258.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/4qt421257797258.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/5xcs41257797258.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/6cnl21257797258.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/7ec2m1257797258.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/8abe81257797258.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. -49810 -46280 -43880 -43470 -40520 -37640 > > #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/9s9jh1257797258.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/10bieg1257797258.tab") > > system("convert tmp/1nnp81257797258.ps tmp/1nnp81257797258.png") > system("convert tmp/2zesk1257797258.ps tmp/2zesk1257797258.png") > system("convert tmp/3k5kq1257797258.ps tmp/3k5kq1257797258.png") > system("convert tmp/4qt421257797258.ps tmp/4qt421257797258.png") > system("convert tmp/5xcs41257797258.ps tmp/5xcs41257797258.png") > system("convert tmp/6cnl21257797258.ps tmp/6cnl21257797258.png") > system("convert tmp/7ec2m1257797258.ps tmp/7ec2m1257797258.png") > system("convert tmp/8abe81257797258.ps tmp/8abe81257797258.png") > > > proc.time() user system elapsed 1.637 1.184 3.785