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(2.396,2.396,1.116,1.116,1.116,0.968,0.968,0.968,2.516,2.516,2.516,0.602,0.602,0.602,3.432,3.432,3.432,2.314,2.314,2.314,0.18,0.18,0.18,-3.748,-3.748,-3.748,-0.502,-0.502,-0.502,-1.09,-1.09,-1.09,-3.074,-3.074,-3.074,-0.706,-0.706,-0.706,-1.614,-1.614,-1.614,-0.298,-0.298,-0.298,-1.482,-1.482,-1.482,1.616,1.616,1.616,-2.256,-2.256,-2.256,0.428,0.428,0.428,0.204,0.204,0.204) > x <- c(0.024,0.924,0.104,-0.296,-0.196,-0.288,0.212,-0.188,-0.596,-0.196,-0.196,0.998,1.098,0.298,-0.232,0.268,0.268,-0.054,-0.654,-0.254,-0.04,-0.34,-0.44,0.748,0.348,0.148,-0.518,-0.418,-0.818,-0.97,-0.97,-0.97,-1.106,-1.106,-1.106,-1.234,-1.034,-0.234,-0.066,0.134,0.534,0.298,1.098,0.798,1.462,2.162,2.262,3.204,3.304,2.604,0.416,-0.084,-0.684,-0.548,-1.848,-1.748,-2.844,-3.644,-4.344) > 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 2.3704481 2 2.2690417 3 1.0814342 4 1.1265038 5 1.1152364 6 0.9776024 7 0.9212655 8 0.9663350 9 2.5603059 10 2.5152364 11 2.5152364 12 0.4667039 13 0.4554365 14 0.5455755 15 3.4352926 16 3.3789557 17 3.3789557 18 2.2972367 19 2.3648410 20 2.3197715 21 0.1616593 22 0.1954614 23 0.2067288 24 -3.8551277 25 -3.8100582 26 -3.7875234 27 -0.4664827 28 -0.4777500 29 -0.4326805 30 -1.0035541 31 -1.0035541 32 -1.0035541 33 -2.9722305 34 -2.9722305 35 -2.9722305 36 -0.5898082 37 -0.6123430 38 -0.7024820 39 -1.6294112 40 -1.6519460 41 -1.6970155 42 -0.3544245 43 -0.4445635 44 -0.4107614 45 -1.6695768 46 -1.7484485 47 -1.7597158 48 1.2321454 49 1.2208781 50 1.2997497 51 -2.3257200 52 -2.2693831 53 -2.2017788 54 0.4668976 55 0.6133735 56 0.6021061 57 0.5015966 58 0.5917357 59 0.6706073 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ozlz1257679187.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/23px31257679187.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/3fusc1257679187.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/4rvs01257679187.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/5d1yh1257679187.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/6fkqj1257679187.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/7e9hx1257679187.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/80iak1257679187.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. -4.344 -0.669 -0.196 -0.111 0.323 3.304 > > #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/9smjz1257679187.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/1072d01257679187.tab") > > system("convert tmp/1ozlz1257679187.ps tmp/1ozlz1257679187.png") > system("convert tmp/23px31257679187.ps tmp/23px31257679187.png") > system("convert tmp/3fusc1257679187.ps tmp/3fusc1257679187.png") > system("convert tmp/4rvs01257679187.ps tmp/4rvs01257679187.png") > system("convert tmp/5d1yh1257679187.ps tmp/5d1yh1257679187.png") > system("convert tmp/6fkqj1257679187.ps tmp/6fkqj1257679187.png") > system("convert tmp/7e9hx1257679187.ps tmp/7e9hx1257679187.png") > system("convert tmp/80iak1257679187.ps tmp/80iak1257679187.png") > > > proc.time() user system elapsed 1.590 1.184 2.587