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(100.00,100.28,100.00,98.62,98.35,98.35,104.68,104.13,103.58,104.68,104.41,105.79,107.99,108.54,107.99,109.09,107.99,109.09,115.43,115.98,115.70,115.15,112.95,115.15,117.36,117.91,118.46,116.80,116.53,117.63,121.49,123.69,124.52,127.27,125.34,127.00,127.00,127.55,127.27,125.62,125.34,125.62,130.03,130.03,129.75,128.10,126.45,128.10,128.93,128.65,127.55,126.72,127.27,127.00,131.13,131.13,129.75,124.79,122.04,121.76,100.00,100.28,100.00,98.62,98.35,98.35,104.68,104.13,103.58,104.68,104.41,105.79,107.99,108.54,107.99,109.09,107.99,109.09,115.43,115.98,115.70,115.15,112.95,115.15,117.36,117.91,118.46,116.80,116.53,117.63,121.49,123.69,124.52,127.27,125.34,127.00,127.00,127.55,127.27,125.62,125.34,125.62,130.03,130.03,129.75,128.10,126.45,128.10,128.93,128.65,127.55,126.72,127.27,127.00,131.13,131.13,129.75,124.79,122.04,121.76) > x <- c(100.00,106.54,127.63,141.72,147.95,142.16,147.95,155.82,164.13,159.16,147.14,159.16,178.85,200.44,189.43,160.16,157.02,168.91,173.19,175.83,158.78,166.96,171.24,179.55,191.00,196.41,206.80,208.94,224.86,217.31,229.96,252.36,255.25,290.37,269.67,240.53,252.86,265.51,299.31,297.42,277.09,313.59,335.75,370.67,375.33,358.65,334.80,335.05,364.07,350.47,350.16,393.46,405.29,406.86,426.12,422.97,373.63,335.18,329.89,346.32,100.00,106.54,127.63,141.72,147.95,142.16,147.95,155.82,164.13,159.16,147.14,159.16,178.85,200.44,189.43,160.16,157.02,168.91,173.19,175.83,158.78,166.96,171.24,179.55,191.00,196.41,206.80,208.94,224.86,217.31,229.96,252.36,255.25,290.37,269.67,240.53,252.86,265.51,299.31,297.42,277.09,313.59,335.75,370.67,375.33,358.65,334.80,335.05,364.07,350.47,350.16,393.46,405.29,406.86,426.12,422.97,373.63,335.18,329.89,346.32) > 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 -3.19596359 2 -3.56656181 3 -5.94459186 4 -8.72626295 5 -9.61602242 6 -9.04003409 7 -3.28602242 8 -4.61892885 9 -5.99560640 10 -4.40119155 11 -3.47544374 12 -3.29119155 13 -3.04994980 14 -4.64771978 15 -4.10244662 16 -0.09067140 17 -0.87830467 18 -0.96112009 19 4.95310615 20 5.24047934 21 6.65661080 22 5.29286562 23 2.66709186 24 4.04041430 25 5.11137001 26 5.12318402 27 4.63958837 28 2.76670149 29 0.91298227 30 2.76405514 31 5.36563503 32 5.33728638 33 5.87978961 34 5.13605726 35 5.26529017 36 9.82413301 37 8.59754646 38 7.88912635 39 4.24670740 40 2.78472432 41 4.52714968 42 1.17613513 43 3.38166165 44 -0.09217474 45 -0.83575084 46 -0.82642693 47 -0.10383250 48 1.52129754 49 -0.53560772 50 0.53731825 51 -0.53184300 52 -5.66932053 53 -6.29616716 54 -6.72235053 55 -4.50833245 56 -4.19497092 57 -0.66663509 58 -1.80163484 59 -4.02538643 60 -5.93984037 61 -3.19596359 62 -3.56656181 63 -5.94459186 64 -8.72626295 65 -9.61602242 66 -9.04003409 67 -3.28602242 68 -4.61892885 69 -5.99560640 70 -4.40119155 71 -3.47544374 72 -3.29119155 73 -3.04994980 74 -4.64771978 75 -4.10244662 76 -0.09067140 77 -0.87830467 78 -0.96112009 79 4.95310615 80 5.24047934 81 6.65661080 82 5.29286562 83 2.66709186 84 4.04041430 85 5.11137001 86 5.12318402 87 4.63958837 88 2.76670149 89 0.91298227 90 2.76405514 91 5.36563503 92 5.33728638 93 5.87978961 94 5.13605726 95 5.26529017 96 9.82413301 97 8.59754646 98 7.88912635 99 4.24670740 100 2.78472432 101 4.52714968 102 1.17613513 103 3.38166165 104 -0.09217474 105 -0.83575084 106 -0.82642693 107 -0.10383250 108 1.52129754 109 -0.53560772 110 0.53731825 111 -0.53184300 112 -5.66932053 113 -6.29616716 114 -6.72235053 115 -4.50833245 116 -4.19497092 117 -0.66663509 118 -1.80163484 119 -4.02538643 120 -5.93984037 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1siit1257945777.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/2ya4o1257945777.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/3vu6u1257945777.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/4l7pi1257945777.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/5a9j51257945777.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/6lqgo1257945777.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/7n8i41257945777.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/86wf71257945777.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. 100.0 166.3 227.4 248.1 335.1 426.1 > > #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/99itj1257945777.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/10zhrl1257945777.tab") > > system("convert tmp/1siit1257945777.ps tmp/1siit1257945777.png") > system("convert tmp/2ya4o1257945777.ps tmp/2ya4o1257945777.png") > system("convert tmp/3vu6u1257945777.ps tmp/3vu6u1257945777.png") > system("convert tmp/4l7pi1257945777.ps tmp/4l7pi1257945777.png") > system("convert tmp/5a9j51257945777.ps tmp/5a9j51257945777.png") > system("convert tmp/6lqgo1257945777.ps tmp/6lqgo1257945777.png") > system("convert tmp/7n8i41257945777.ps tmp/7n8i41257945777.png") > system("convert tmp/86wf71257945777.ps tmp/86wf71257945777.png") > > > proc.time() user system elapsed 1.98 1.69 3.48