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(2.2300144,2.2300144,2.163323026,2.104134154,2.116255515,2.140066163,2.151762203,2.140066163,2.104134154,2.091864062,2.066862759,2.151762203,2.163323026,2.163323026,2.140066163,2.128231706,2.140066163,2.163323026,2.163323026,2.151762203,2.140066163,2.116255515,2.079441542,2.104134154,2.091864062,2.091864062,2.079441542,2.066862759,2.066862759,2.079441542,2.079441542,2.066862759,2.079441542,2.041220329,1.974081026,2.014903021,1.987874348,1.945910149,1.945910149,1.945910149,1.974081026,1.987874348,1.960094784,1.916922612,1.85629799,1.808288771,1.871802177,2.041220329,2.066862759,2.014903021,1.931521412,1.887069649,1.931521412,2.041220329,2.079441542,2.079441542,2.041220329,1.987874348,2.00148,2.091864062) > x <- c(4.588024027,4.721173862,4.73532087,4.665324109,4.591071262,4.569543008,4.563305982,4.641502115,4.635699391,4.641502115,4.71939133,4.464758032,4.553876892,4.716711561,4.689511334,4.694096395,4.619073091,4.610157727,4.6121458,4.731802837,4.664382046,4.71492105,4.744062185,4.484131858,4.600157644,4.745801316,4.770684624,4.713127327,4.67562865,4.656813419,4.656813419,4.769836808,4.702296897,4.722063937,4.766438334,4.532599493,4.639571613,4.75617306,4.787491743,4.738826571,4.651099118,4.698660529,4.723841716,4.739701079,4.751000634,4.742320024,4.774068722,4.552823706,4.642465971,4.745801316,4.733563401,4.644390899,4.54648119,4.527208645,4.534747722,4.651099118,4.543294782,4.585987367,4.631812117,4.411585437) > 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.148646309 2 0.193804028 3 0.131910607 4 0.048982359 5 0.035920893 6 0.052430241 7 0.062010996 8 0.076835147 9 0.038935146 10 0.028633046 11 0.030047842 12 0.028588494 13 0.070373946 14 0.125599267 15 0.093117456 16 0.082838021 17 0.069228351 18 0.089461572 19 0.090135826 20 0.119156645 21 0.084594867 22 0.077924504 23 0.050993737 24 -0.012468929 25 0.014611083 26 0.064006083 27 0.060022728 28 0.027923408 29 0.015205745 30 0.021403349 31 0.021403349 32 0.047156408 33 0.036829054 34 0.005311826 35 -0.046777916 36 -0.085262281 37 -0.076011397 38 -0.078430257 39 -0.067808537 40 -0.084313313 41 -0.085895170 42 -0.055971412 43 -0.075210786 44 -0.113004260 45 -0.169796642 46 -0.220749887 47 -0.146468922 48 -0.052085938 49 0.003958634 50 -0.012954958 51 -0.100487052 52 -0.175181637 53 -0.163935917 54 -0.060773277 55 -0.019995189 56 0.019465346 57 -0.055317669 58 -0.094184475 59 -0.065037376 60 -0.049343114 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1h7vh1256470451.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/2nm281256470451.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/3gfnp1256470451.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/4rcsh1256470451.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/5q48q1256470451.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/6d2o71256470451.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/7ow351256470451.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/8tshl1256470451.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. 4.412 4.598 4.661 4.657 4.732 4.787 > > #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/9kadq1256470451.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/10ln3m1256470451.tab") > > system("convert tmp/1h7vh1256470451.ps tmp/1h7vh1256470451.png") > system("convert tmp/2nm281256470451.ps tmp/2nm281256470451.png") > system("convert tmp/3gfnp1256470451.ps tmp/3gfnp1256470451.png") > system("convert tmp/4rcsh1256470451.ps tmp/4rcsh1256470451.png") > system("convert tmp/5q48q1256470451.ps tmp/5q48q1256470451.png") > system("convert tmp/6d2o71256470451.ps tmp/6d2o71256470451.png") > system("convert tmp/7ow351256470451.ps tmp/7ow351256470451.png") > system("convert tmp/8tshl1256470451.ps tmp/8tshl1256470451.png") > > > proc.time() user system elapsed 1.608 1.167 1.938