R version 2.8.1 (2008-12-22) Copyright (C) 2008 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.2413,1.2758,1.2729,1.2695,1.2858,1.2741,1.2823,1.2588,1.2856,1.2619,1.2590,1.2865,1.2667,1.2505,1.2205,1.2220,1.1990,1.1583,1.1931,1.2028,1.1802,1.2084,1.1996,1.1870,1.2013,1.2120,1.2133,1.1866,1.2067,1.2240,1.2566,1.2608,1.3005,1.2955,1.2500,1.3158,1.3358,1.2817,1.2707,1.2595,1.3182,1.2665,1.2715,1.3041,1.3106,1.2911,1.2233,1.1438,0.9895,1.9903,0.9967,0.9708,0.9946,1.0441,1.0757,1.1461,1.1749,1.1926,1.2109) > x <- c(0.7461,0.7775,0.7790,0.7744,0.7905,0.7719,0.7811,0.7557,0.7637,0.7595,0.7471,0.7615,0.7487,0.7389,0.7337,0.7510,0.7382,0.7159,0.7542,0.7636,0.7433,0.7658,0.7627,0.7480,0.7692,0.7850,0.7913,0.7720,0.7880,0.8070,0.8268,0.8244,0.8487,0.8572,0.8214,0.8827,0.9216,0.8865,0.8816,0.8884,0.9466,0.9180,0.9337,0.9559,0.9626,0.9434,0.8639,0.7996,0.6680,0.6572,0.6928,0.6438,0.6454,0.6873,0.7265,0.7912,0.8114,0.8281,0.8393) > 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.0299180767 2 0.0504240269 3 0.0468555213 4 0.0455056050 5 0.0546303120 6 0.0512197810 7 0.0553196135 8 0.0431396411 9 0.0663742781 10 0.0445460937 11 0.0471724063 12 0.0682547529 13 0.0541593337 14 0.0423269034 15 0.0146443894 16 0.0084342919 17 -0.0088611273 18 -0.0396226779 19 -0.0218918533 20 -0.0163811549 21 -0.0299340462 22 -0.0117616297 23 -0.0191800515 24 -0.0252286970 25 -0.0203769090 26 -0.0167185010 27 -0.0182262244 28 -0.0363247861 29 -0.0233555121 30 -0.0145232493 31 0.0092524772 32 0.0145220861 33 0.0433922960 34 0.0346040978 35 0.0050590973 36 0.0435395031 37 0.0462029254 38 0.0077459557 39 -0.0010702595 40 -0.0153008180 41 0.0174611660 42 -0.0214926612 43 -0.0234896861 44 -0.0007835685 45 0.0027304399 46 -0.0082126888 47 -0.0405818938 48 -0.0914252885 49 -0.1870750668 50 0.8185381733 51 -0.1909276921 52 -0.1949898436 53 -0.1719029162 54 -0.1410765051 55 -0.1269467839 56 -0.0853816573 57 -0.0655841989 58 -0.0553268943 59 -0.0420184025 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1kirj1257506480.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/rcomp/tmp/25vxg1257506480.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/rcomp/tmp/3ye9w1257506480.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/rcomp/tmp/4w5tw1257506480.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/rcomp/tmp/5q2x41257506480.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/rcomp/tmp/6ivyx1257506480.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/rcomp/tmp/7ojds1257506480.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/rcomp/tmp/8t72t1257506480.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.6438 0.7484 0.7775 0.7939 0.8337 0.9626 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9rc8i1257506480.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/rcomp/tmp/101lsb1257506480.tab") > > system("convert tmp/1kirj1257506480.ps tmp/1kirj1257506480.png") > system("convert tmp/25vxg1257506480.ps tmp/25vxg1257506480.png") > system("convert tmp/3ye9w1257506480.ps tmp/3ye9w1257506480.png") > system("convert tmp/4w5tw1257506480.ps tmp/4w5tw1257506480.png") > system("convert tmp/5q2x41257506480.ps tmp/5q2x41257506480.png") > system("convert tmp/6ivyx1257506480.ps tmp/6ivyx1257506480.png") > system("convert tmp/7ojds1257506480.ps tmp/7ojds1257506480.png") > system("convert tmp/8t72t1257506480.ps tmp/8t72t1257506480.png") > > > proc.time() user system elapsed 2.020 1.750 2.875