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.335001067,1.547562509,1.458615023,1.360976553,1.386294361,1.458615023,1.568615918,1.481604541,1.458615023,1.547562509,1.547562509,1.589235205,1.609437912,1.435084525,1.458615023,1.568615918,1.568615918,1.568615918,1.435084525,1.526056303,1.568615918,1.504077397,1.481604541,1.458615023,1.360976553,1.30833282,1.386294361,1.410986974,1.30833282,1.335001067,1.335001067,1.335001067,1.193922468,1.193922468,1.193922468,1.16315081,1.223775432,1.435084525,1.589235205,1.62924054,1.704748092,1.722766598,1.85629799,1.808288771,1.960094784,2.054123734,2.066862759,2.00148,2.014903021,1.916922612,1.648658626,1.547562509,1.410986974,1.360976553,0.955511445,0.993251773,0.587786665,0,-1.203972804,0.262364264) > x <- c(161,149,139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109,105,107,109,109,108,107,99,103,131,137) > 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 0.0595403583 2 0.2360996228 3 0.1171503222 4 0.0075111264 5 0.0178280271 6 0.0811481447 7 0.1761481324 8 0.0741358481 9 0.0361454228 10 0.1280930903 11 0.2360996228 12 0.3017737705 13 0.3219764775 14 0.1176212759 15 0.1111499593 16 0.2061499470 17 0.1851486768 18 0.1791483139 19 0.0276158321 20 0.1095870657 21 0.1431461364 22 0.0816077968 23 0.1551407475 24 0.1501523182 25 0.0495136668 26 -0.0481327881 27 -0.0031732431 28 0.0005180997 29 -0.0991358729 30 -0.0904687146 31 -0.1084698034 32 -0.1174703478 33 -0.2795502170 34 -0.2855505799 35 -0.1925449547 36 -0.2053155239 37 -0.1626919907 38 0.0216154692 39 0.1487645161 40 0.1857696696 41 0.2612772216 42 0.2672950018 43 0.3828253050 44 0.3288157231 45 0.4536201030 46 0.5566495974 47 0.6563938847 48 0.6030118515 49 0.6074343281 50 0.4854524674 51 0.2051877556 52 0.1100920015 53 -0.0204831706 54 -0.0704935916 55 -0.4789588810 56 -0.4442187345 57 -0.8736852941 58 -1.4494712333 59 -2.5694389565 60 -1.0851007997 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1xq2b1256669637.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/2vayv1256669637.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/3obc31256669637.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/463uy1256669637.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/5l0kr1256669637.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/6yk8j1256669637.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/7x3yh1256669637.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/8m39d1256669637.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. 84.0 106.8 116.5 119.5 131.2 161.0 > > #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/97h061256669637.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/10ug6r1256669637.tab") > > system("convert tmp/1xq2b1256669637.ps tmp/1xq2b1256669637.png") > system("convert tmp/2vayv1256669637.ps tmp/2vayv1256669637.png") > system("convert tmp/3obc31256669637.ps tmp/3obc31256669637.png") > system("convert tmp/463uy1256669637.ps tmp/463uy1256669637.png") > system("convert tmp/5l0kr1256669637.ps tmp/5l0kr1256669637.png") > system("convert tmp/6yk8j1256669637.ps tmp/6yk8j1256669637.png") > system("convert tmp/7x3yh1256669637.ps tmp/7x3yh1256669637.png") > system("convert tmp/8m39d1256669637.ps tmp/8m39d1256669637.png") > > > proc.time() user system elapsed 1.629 1.195 2.872