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.098612289,-0.693147181,-1.609437912,-2.397895273,-2.397895273,-2.397895273,-2.302585093,-2.63905733,-2.079441542,-2.197224577,-1.609437912,0,-0.693147181,-1.609437912,-1.386294361,-1.791759469,-0.693147181,-0.693147181,-0.693147181,-0.693147181,0.693147181,0,-2.079441542,0,0,0,0.693147181,0.693147181,0,0,-0.693147181,-0.693147181,0,-2.079441542,-1.386294361,-1.791759469,-1.098612289,-1.098612289,-1.945910149,-2.197224577,-2.397895273,-2.564949357,-2.397895273,-2.197224577,-2.833213344,-3.091042453,-3.218875825,-2.995732274,-3.17805383,-3.17805383,-3.091042453,-2.944438979,-2.890371758,-2.833213344,-2.397895273,-2.397895273,-2.48490665) > x <- c(4.613138356,4.618382517,4.62379565,4.623501143,4.625364893,4.627127353,4.631130288,4.631325143,4.630252966,4.628593701,4.631617356,4.632396172,4.632979887,4.637734177,4.636959508,4.64053733,4.643910014,4.643717596,4.646791861,4.648038086,4.64784646,4.647463098,4.649952329,4.650908078,4.653198155,4.658331734,4.656148431,4.659468959,4.657193214,4.656623468,4.660604893,4.66032103,4.660699496,4.665229942,4.672174415,4.676932552,4.680741373,4.688683786,4.694279361,4.695833221,4.702296897,4.706100905,4.711510222,4.708448535,4.71088064,4.712139407,4.710340684,4.711690029,4.71357606,4.716264233,4.710160633,4.711060561,4.709169776,4.705015521,4.704834509,4.706462437,4.704653464) > 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.512271724 2 -0.009812298 3 -0.825983461 4 -1.619887928 5 -1.585416607 6 -1.552818713 7 -1.383471534 8 -1.716339795 9 -1.176554648 10 -1.325026916 11 -0.681315699 12 0.942526943 13 0.260175967 14 -0.568180943 15 -0.359365421 16 -0.698656283 17 0.462336085 18 0.458777183 19 0.515637801 20 0.538687578 21 1.921437687 22 1.221199966 23 -0.812201559 24 1.284917209 25 1.327273738 26 1.422222766 27 2.074988276 28 2.136403695 29 1.401165065 30 1.390627226 31 0.771119203 32 0.765868964 33 1.466016131 34 -0.529631737 35 0.291958185 36 -0.025501950 37 0.738091960 38 0.884992279 39 0.141188377 40 -0.081386356 41 -0.162506977 42 -0.259203352 43 0.007899722 44 0.151942439 45 -0.439062896 46 -0.673610255 47 -0.834712229 48 -0.586611627 49 -0.734049759 50 -0.684330175 51 -0.710209023 52 -0.546960770 53 -0.527864900 54 -0.547542252 55 -0.115572121 56 -0.085462488 57 -0.205932048 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/18y8q1256761643.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/2uf711256761643.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/335yp1256761643.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/4zwol1256761643.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/5xgxh1256761643.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/67d331256761643.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/7374v1256761643.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/82m8f1256761643.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.613 4.638 4.658 4.667 4.705 4.716 > > #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/9y7ky1256761643.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/104da91256761643.tab") > > system("convert tmp/18y8q1256761643.ps tmp/18y8q1256761643.png") > system("convert tmp/2uf711256761643.ps tmp/2uf711256761643.png") > system("convert tmp/335yp1256761643.ps tmp/335yp1256761643.png") > system("convert tmp/4zwol1256761643.ps tmp/4zwol1256761643.png") > system("convert tmp/5xgxh1256761643.ps tmp/5xgxh1256761643.png") > system("convert tmp/67d331256761643.ps tmp/67d331256761643.png") > system("convert tmp/7374v1256761643.ps tmp/7374v1256761643.png") > system("convert tmp/82m8f1256761643.ps tmp/82m8f1256761643.png") > > > proc.time() user system elapsed 1.577 1.127 2.377