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(5.694,5.45,4.748,3.882,3.816,4.116,4.282,4.292,3.826,3.56,3.748,4.892,5.092,5.014,4.26,3.882,4.048,4.082,4.038,3.684,3.55,3.594,3.528,4.262,4.462,4.174,3.674,3.44,3.462,3.584,3.606,3.606,3.706,3.196,2.696,2.818,2.452,2.14,2.494,2.648,2.792,2.78,2.502,2.178,1.834,1.754,2.286,3.608,3.998,3.62,3.044,2.292,2.482,2.916,2.928,2.442,1.942,1.222,1.168,1.836) > x <- c(1.414,1.37,1.618,1.202,1.086,1.286,1.502,1.862,1.346,1.13,1.018,1.562,1.562,1.734,1.33,1.402,1.818,1.802,1.758,1.254,1.47,1.314,0.498,-0.118,-0.418,-0.606,-0.406,-0.09,0.082,0.254,0.226,0.026,0.126,-0.434,-0.834,-0.462,-0.778,-0.69,-0.286,0.118,0.562,1.15,1.222,1.398,0.954,1.374,2.106,3.278,3.018,2.69,1.314,-0.138,-0.098,0.586,0.898,0.162,-0.038,-1.058,-1.462,-1.394) > 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.994373245 2 1.770976370 3 0.952849665 4 0.281642846 5 0.269960176 6 0.476309608 7 0.541166995 8 0.382595973 9 0.158214438 10 -0.006642949 11 0.233801369 12 1.123071824 13 1.323071824 14 1.164532336 15 0.599706483 16 0.187992279 17 0.159199098 18 0.200691143 19 0.177294268 20 0.059293699 21 -0.175848914 22 -0.058801471 23 0.257292845 24 1.279736594 25 1.620212446 26 1.420243980 27 0.826593412 28 0.444625515 29 0.386086026 30 0.427546538 31 0.462657617 32 0.556308185 33 0.609482901 34 0.361704491 35 0.049005627 36 -0.003184429 37 -0.221216532 38 -0.574422782 39 -0.409596929 40 -0.444771076 41 -0.508675337 42 -0.796008006 43 -1.107722210 44 -1.514134710 45 -1.650230449 46 -1.926896642 47 -1.737657720 48 -0.964450047 49 -0.452704309 50 -0.677117378 51 -0.608801471 52 -0.680898349 53 -0.509628463 54 -0.395913405 55 -0.530008290 56 -0.671374201 57 -1.077723633 58 -1.320105737 59 -1.184931590 60 -0.548772783 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1on251257801613.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/2imq81257801613.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/3jisx1257801613.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/4ppf41257801613.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/5w6cj1257801613.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/6ag4z1257801613.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/7wnsk1257801613.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/8kqo51257801613.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. -1.4620 -0.0920 1.0520 0.7429 1.4050 3.2780 > > #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/9yyiv1257801613.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/10ij0e1257801613.tab") > > system("convert tmp/1on251257801613.ps tmp/1on251257801613.png") > system("convert tmp/2imq81257801613.ps tmp/2imq81257801613.png") > system("convert tmp/3jisx1257801613.ps tmp/3jisx1257801613.png") > system("convert tmp/4ppf41257801613.ps tmp/4ppf41257801613.png") > system("convert tmp/5w6cj1257801613.ps tmp/5w6cj1257801613.png") > system("convert tmp/6ag4z1257801613.ps tmp/6ag4z1257801613.png") > system("convert tmp/7wnsk1257801613.ps tmp/7wnsk1257801613.png") > system("convert tmp/8kqo51257801613.ps tmp/8kqo51257801613.png") > > > proc.time() user system elapsed 1.531 1.114 2.478