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.641853886,0.470003629,0.530628251,0.693147181,0.916290732,0.875468737,0.832909123,0.832909123,0.741937345,0.875468737,0.78845736,0.875468737,0.641853886,0.741937345,0.741937345,0.741937345,0.693147181,0.741937345,0.78845736,0.78845736,0.955511445,0.916290732,0.832909123,0.78845736,0.875468737,0.832909123,0.78845736,0.916290732,0.916290732,0.916290732,0.875468737,0.832909123,0.530628251,0.470003629,0.641853886,0.641853886,0.587786665,0.587786665,0.641853886,0.641853886,0.641853886,0.641853886,0.587786665,0.530628251,0.741937345,0.955511445,1.131402111,1.131402111,1.16315081,1.193922468,1.280933845,1.193922468,1.30833282,1.386294361,1.386294361,1.335001067,1.280933845,1.16315081,0.741937345,0.470003629) > x <- c(2.186051277,2.197224577,2.197224577,2.197224577,2.197224577,2.197224577,2.197224577,2.197224577,2.197224577,2.197224577,2.197224577,2.208274414,2.197224577,2.197224577,2.208274414,2.197224577,2.197224577,2.197224577,2.197224577,2.186051277,2.186051277,2.186051277,2.186051277,2.174751721,2.174751721,2.163323026,2.163323026,2.140066163,2.140066163,2.128231706,2.104134154,2.104134154,2.091864062,2.091864062,2.079441542,2.066862759,2.054123734,2.041220329,2.028148247,2.014903021,2.014903021,2.014903021,2.014903021,2.014903021,2.00148,2.00148,1.987874348,1.987874348,1.987874348,1.974081026,1.974081026,1.987874348,2.00148,2.00148,2.014903021,2.028148247,2.041220329,2.066862759,2.079441542,2.104134154) > 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.1128969781 2 -0.2722944296 3 -0.2116698076 4 -0.0491508776 5 0.1739926734 6 0.1331706784 7 0.0906110644 8 0.0906110644 9 -0.0003607136 10 0.1331706784 11 0.0461593014 12 0.1454858826 13 -0.1004441726 14 -0.0003607136 15 0.0119544906 16 -0.0003607136 17 -0.0491508776 18 -0.0003607136 19 0.0461593014 20 0.0337064959 21 0.2007605809 22 0.1615398679 23 0.0781582589 24 0.0211129762 25 0.1081243532 26 0.0528272923 27 0.0083755293 28 0.1102887890 29 0.1102887890 30 0.0970991144 31 0.0294200469 32 -0.0131395671 33 -0.3290956353 34 -0.3897202573 35 -0.2317150796 36 -0.2457343164 37 -0.3139993662 38 -0.3283803989 39 -0.2888822035 40 -0.3036442007 41 -0.3036442007 42 -0.3036442007 43 -0.3577114217 44 -0.4148698357 45 -0.2185208940 46 -0.0049467940 47 0.1557801748 48 0.1557801748 49 0.1875288738 50 0.2029276736 51 0.2899390506 52 0.2183005318 53 0.3478745810 54 0.4258361220 55 0.4407962743 56 0.4042649775 57 0.3647667811 58 0.2755626076 59 -0.1316316206 60 -0.3760450611 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1p4u01256756940.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/2z9w51256756940.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/3f5jd1256756940.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/4it4k1256756940.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/5c0dz1256756940.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/67i741256756940.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/7dg731256756940.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/8z9cd1256756940.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.974 2.015 2.116 2.109 2.197 2.208 > > #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/9bl9i1256756940.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/104qz11256756940.tab") > > system("convert tmp/1p4u01256756940.ps tmp/1p4u01256756940.png") > system("convert tmp/2z9w51256756940.ps tmp/2z9w51256756940.png") > system("convert tmp/3f5jd1256756940.ps tmp/3f5jd1256756940.png") > system("convert tmp/4it4k1256756940.ps tmp/4it4k1256756940.png") > system("convert tmp/5c0dz1256756940.ps tmp/5c0dz1256756940.png") > system("convert tmp/67i741256756940.ps tmp/67i741256756940.png") > system("convert tmp/7dg731256756940.ps tmp/7dg731256756940.png") > system("convert tmp/8z9cd1256756940.ps tmp/8z9cd1256756940.png") > > > proc.time() user system elapsed 1.580 1.144 2.130