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(8.6,8.5,8.3,7.8,7.8,8,8.6,8.9,8.9,8.6,8.3,8.3,8.3,8.4,8.5,8.4,8.6,8.5,8.5,8.5,8.5,8.5,8.5,8.5,8.5,8.5,8.5,8.5,8.6,8.4,8.1,8,8,8,8,7.9,7.8,7.8,7.9,8.1,8,7.6,7.3,7,6.8,7,7.1,7.2,7.1,6.9,6.7,6.7,6.6,6.9,7.3,7.5,7.3,7.1,6.9,7.1) > x <- c(0.201397124,0.100370545,0.053078443,0.283301229,0.416640507,0.354108439,0.382017043,0.354108439,0.307496038,0.456366033,0.40654018,0.356025857,0.354108439,0.409933123,0.487138375,0.440909082,0.399673721,0.457881897,0.496929648,0.492760389,0.499687083,0.392696953,0.409933123,0.460897843,0.419955748,0.376576957,0.227886705,0.292256071,0.340444115,0.271841607,0.204119983,0.212187604,0.086359831,0.08278537,0.173186268,0.214843848,0.220108088,0.247973266,0.260071388,0.250420002,0.10720997,0.11058971,0.136720567,0.049218023,0.178976947,0.350248018,0.46834733,0.489958479,0.539076099,0.561101384,0.64246452,0.618048097,0.716837723,0.763427994,0.771587481,0.731588765,0.737192643,0.673941999,0.496929648,0.419955748) > 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.478457643 2 0.258291194 3 0.002039423 4 -0.224121207 5 -0.065520294 6 0.060100699 7 0.693296695 8 0.960100699 9 0.904657401 10 0.781731384 11 0.422465833 12 0.362381379 13 0.360100699 14 0.526501582 15 0.718333664 16 0.563346055 17 0.714298498 18 0.683534435 19 0.729979931 20 0.725020790 21 0.733259772 22 0.605999954 23 0.626501582 24 0.687121763 25 0.638423032 26 0.586825964 27 0.409965777 28 0.486530164 29 0.643847617 30 0.362248102 31 -0.018303642 32 -0.108707579 33 -0.258373903 34 -0.262625560 35 -0.155097867 36 -0.205548099 37 -0.299286529 38 -0.266142187 39 -0.151752030 40 0.036768093 41 -0.233573626 42 -0.629553581 43 -0.898472134 44 -1.302552368 45 -1.348210122 46 -0.944491093 47 -0.704017416 48 -0.578311953 49 -0.619888812 50 -0.793690753 51 -0.896913061 52 -0.925955268 53 -0.908449571 54 -0.553032596 55 -0.143327263 56 0.009096112 57 -0.184238334 58 -0.459472053 59 -0.870020069 60 -0.761576968 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1gjzp1256653694.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/2yaso1256653694.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/3t18f1256653694.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/45y9d1256653694.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/5bc901256653694.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/68v731256653694.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/75nzq1256653694.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/8popr1256653694.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. 0.04922 0.22590 0.37930 0.37360 0.48780 0.77160 > > #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/9mjmc1256653694.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/10w3a21256653694.tab") > > system("convert tmp/1gjzp1256653694.ps tmp/1gjzp1256653694.png") > system("convert tmp/2yaso1256653694.ps tmp/2yaso1256653694.png") > system("convert tmp/3t18f1256653694.ps tmp/3t18f1256653694.png") > system("convert tmp/45y9d1256653694.ps tmp/45y9d1256653694.png") > system("convert tmp/5bc901256653694.ps tmp/5bc901256653694.png") > system("convert tmp/68v731256653694.ps tmp/68v731256653694.png") > system("convert tmp/75nzq1256653694.ps tmp/75nzq1256653694.png") > system("convert tmp/8popr1256653694.ps tmp/8popr1256653694.png") > > > proc.time() user system elapsed 1.595 1.161 2.427