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(0.0142377,0.05948486,0.1525919,0.12065245,0.00982269,-0.03951274,-0.00147403,0.03059889,0.10436959,0.08331938,-0.01716591,0.01109873,-0.01768092,-0.02931767,-0.06896155,-0.08861504,-0.08324867,-0.05371193,0.06273226,0.07767516,0.06579092,0.05516475,0.05925245,0.08543882,0.09550461,0.08896114,0.07296073,0.0845536,0.10957533,0.10009183,0.06547486,0.05005369,0.04102925,0.03095616,-0.01776122,0.00992901,-0.00692717,-0.0119645,-0.0060741,-0.04384874,0.04100349,0.0704824,0.03940004,0.05244081,0.08466181,0.04539119,0.00405616,0.08533605,0.06064081,0.01054517,0.02504058,0.01554287,-0.00581619,-0.08928089,-0.05639107,-0.04552528,-0.06380895,-0.07245358,-0.0661626,-0.06886088) > x <- c(-0.533226576,-0.515978057,-0.477093095,-0.496333869,-0.558827111,-0.581203315,-0.559508891,-0.526763132,-0.485216419,-0.488433897,-0.534946188,-0.523998828,-0.540816723,-0.552659929,-0.562550228,-0.572475926,-0.551776608,-0.529103402,-0.475390277,-0.471325588,-0.483238705,-0.488910901,-0.480923869,-0.463863837,-0.441495171,-0.434380513,-0.43007547,-0.430772563,-0.403799892,-0.43120666,-0.452248414,-0.457170432,-0.467120671,-0.471652125,-0.504228836,-0.479929931,-0.502923197,-0.524137056,-0.524042456,-0.541890172,-0.48902791,-0.472776364,-0.489501826,-0.485214052,-0.46030773,-0.468320878,-0.470662125,-0.443154969,-0.455964052,-0.489908091,-0.480143313,-0.493100702,-0.500777231,-0.552228157,-0.526974209,-0.521835543,-0.536568007,-0.536564655,-0.533739402,-0.536517444) > 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.033567375 2 0.058423069 3 0.105559703 4 0.096366994 5 0.059417715 6 0.036535781 7 0.048927006 8 0.042287382 9 0.066940913 10 0.049694455 11 0.004196717 12 0.019519219 13 0.010621945 14 0.012986417 15 -0.014964998 16 -0.022884174 17 -0.041988859 18 -0.039256735 19 0.013686965 20 0.023824526 21 0.026024158 22 0.022103746 23 0.016749053 24 0.022766789 25 0.006387994 26 -0.008566535 27 -0.029656433 28 -0.017239449 29 -0.024105230 30 -0.001188023 31 -0.010929105 32 -0.020531389 33 -0.017792502 34 -0.022508436 35 -0.032713123 36 -0.033749436 37 -0.023422620 38 -0.003380596 39 0.002397966 40 -0.014276827 41 0.008080816 42 0.018346896 43 0.007037637 44 0.015009334 45 0.017785694 46 -0.012011658 47 -0.050578830 48 -0.001818327 49 -0.011370470 50 -0.021336940 51 -0.018385602 52 -0.012564886 53 -0.024848634 54 -0.047487250 55 -0.044453040 56 -0.039662261 57 -0.040528983 58 -0.049177576 59 -0.046226654 60 -0.045640689 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1x06a1257273456.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/22wt21257273456.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/3indk1257273456.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/4o06x1257273456.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/5cs7a1257273456.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/6fxi61257273456.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/7ryce1257273456.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/850pf1257273456.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.5812 -0.5334 -0.4897 -0.4982 -0.4712 -0.4038 > > #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/97kqj1257273456.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/10djbq1257273456.tab") > > system("convert tmp/1x06a1257273456.ps tmp/1x06a1257273456.png") > system("convert tmp/22wt21257273456.ps tmp/22wt21257273456.png") > system("convert tmp/3indk1257273456.ps tmp/3indk1257273456.png") > system("convert tmp/4o06x1257273456.ps tmp/4o06x1257273456.png") > system("convert tmp/5cs7a1257273456.ps tmp/5cs7a1257273456.png") > system("convert tmp/6fxi61257273456.ps tmp/6fxi61257273456.png") > system("convert tmp/7ryce1257273456.ps tmp/7ryce1257273456.png") > system("convert tmp/850pf1257273456.ps tmp/850pf1257273456.png") > > > proc.time() user system elapsed 1.571 1.167 2.103