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(8892.49,9880.36,13386.49,13642.24,9960.04,9216,13432.81,11902.81,13759.29,12056.04,12723.84,12254.49,10000,12836.89,14981.76,12656.25,10857.64,8556.25,13735.84,11946.49,11257.21,14113.44,11088.09,11236,10404,12746.41,13572.25,13179.04,10100.25,7293.16,13133.16,12078.01,10140.49,13340.25,10140.49,9801,10465.29,11837.44,11214.81,12814.24,9158.49,6544.81,12973.21,9623.61,10567.84,10962.09,9196.81,8949.16,10322.56,10795.21,12166.09,13018.81,9370.24,7638.76,12409.96,9486.76,10588.41,12701.29,9409,9044.01) > x <- c(85,96.1,113.6,116.8,102.7,106.8,124.2,117.8,121.6,117.9,111.4,109.8,92.6,104.9,120.3,109.1,93.1,87.3,106.9,102.1,102.4,113.3,100.6,103.5,93.7,102.6,108.1,105.9,87.1,81.8,103.8,95.8,92.7,101.1,88,92.8,89.7,95.6,95.2,96.9,79.2,73.5,99.7,87.8,91.3,93.9,90,89.8,88.9,104.2,110.8,110.5,87.1,89.2,96.5,95.4,101,107.6,93.8,93.8) > 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 -288.74753 2 -832.56481 3 258.74291 4 72.92540 5 -1663.61778 6 -2973.41615 7 -1157.62945 8 -1804.49444 9 -472.37585 10 -1665.06343 11 -100.32943 12 -348.89568 13 -229.96035 14 909.65456 15 929.48095 16 149.45721 17 558.68473 18 -942.36417 19 1532.62487 20 405.62612 21 -325.05083 22 1027.08986 23 -245.78911 24 -498.04966 25 22.25082 26 1136.55120 27 1203.44705 28 1113.81471 29 629.23380 30 -1446.51002 31 1357.71339 32 1406.48215 33 -103.26933 34 1937.37597 35 545.28294 36 -456.55832 37 635.50020 38 1193.51012 39 626.07605 40 1990.92332 41 777.59357 42 -1049.54431 43 1763.52175 44 56.00091 45 517.26645 46 552.74285 47 -674.37675 48 -894.42878 49 603.16208 50 -1035.43255 51 -575.28553 52 318.83143 53 -100.77620 54 -2122.03488 55 1641.83926 56 -1129.57191 57 -800.66505 58 401.48198 59 -986.54816 60 -1351.53816 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/17n3w1256654741.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/2gi0t1256654741.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/3zdmt1256654741.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/44gvx1256654741.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/5gjl41256654741.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/6dg2a1256654741.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/7c4qh1256654741.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/8xash1256654741.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. 73.50 92.28 98.30 99.58 107.10 124.20 > > #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/9fuym1256654741.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/10hdj11256654741.tab") > > system("convert tmp/17n3w1256654741.ps tmp/17n3w1256654741.png") > system("convert tmp/2gi0t1256654741.ps tmp/2gi0t1256654741.png") > system("convert tmp/3zdmt1256654741.ps tmp/3zdmt1256654741.png") > system("convert tmp/44gvx1256654741.ps tmp/44gvx1256654741.png") > system("convert tmp/5gjl41256654741.ps tmp/5gjl41256654741.png") > system("convert tmp/6dg2a1256654741.ps tmp/6dg2a1256654741.png") > system("convert tmp/7c4qh1256654741.ps tmp/7c4qh1256654741.png") > system("convert tmp/8xash1256654741.ps tmp/8xash1256654741.png") > > > proc.time() user system elapsed 1.596 1.164 2.039