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(8.623353387,8.274357007,8.231908244,8.327967858,8.441175705,8.29304914,8.368229038,8.329175442,8.395929104,8.560061092,8.502891407,8.657824321,8.629092284,8.333991247,8.509564164,8.557951184,8.466951975,8.409830673,8.653819789,8.653645315,8.525161361,8.716371865,8.497806478,8.58839695,8.626585568,8.43793351,8.461891876,8.519390775,8.575273402,8.329899293,8.43923165,8.462948177,8.347353412,8.540128163,8.344029572,8.323851131,8.537583881,8.366370302,8.429017501,8.245121966,8.617219505,8.35396813,8.250620082,8.387995253,8.481773246,8.391403185,8.427049642,8.320204598,8.475120415,8.272315148,8.240912542,8.390495538,8.29953457,8.318742253,8.473868067,8.059276223,8.184513753,8.269500767,8.337587942,8.259199363,8.268731832) > x <- c(2.406945108,2.388762789,2.302585093,2.219203484,2.219203484,2.251291799,2.261763098,2.251291799,2.208274414,2.186051277,2.197224577,2.312535424,2.332143895,2.32238772,2.261763098,2.219203484,2.2300144,2.240709689,2.240709689,2.219203484,2.197224577,2.197224577,2.197224577,2.282382386,2.302585093,2.282382386,2.2300144,2.197224577,2.197224577,2.208274414,2.208274414,2.208274414,2.219203484,2.174751721,2.116255515,2.128231706,2.091864062,2.041220329,2.066862759,2.066862759,2.079441542,2.066862759,2.028148247,1.960094784,1.916922612,1.871802177,1.931521412,2.104134154,2.163323026,2.116255515,2.066862759,2.014903021,2.054123734,2.116255515,2.128231706,2.104134154,2.041220329,1.974081026,1.987874348,2.091864062,2.140066163) > 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.0993177749 2 -0.2419702618 3 -0.2478842313 4 -0.1164752170 5 -0.0032673700 6 -0.1649976866 7 -0.0942570665 8 -0.1288713846 9 -0.0438806223 10 0.1296728025 11 0.0677662282 12 0.1738134307 13 0.1367684372 14 -0.1541964967 15 0.0470780595 16 0.1135081090 17 0.0179256423 18 -0.0437298976 19 0.2002592184 20 0.2092022400 21 0.0900361822 22 0.2812466862 23 0.0626812992 24 0.1171693559 25 0.1467930927 26 -0.0332940841 27 0.0128655433 28 0.0842655962 29 0.1401482232 30 -0.1099104333 31 -0.0005780763 32 0.0231384507 33 -0.0970896630 34 0.1145302887 35 -0.0567689991 36 -0.0820247129 37 0.1471259982 38 -0.0026173116 39 0.0491588508 40 -0.1347366842 41 0.2320281149 42 -0.0258905202 43 -0.1128256590 44 0.0534005876 45 0.1654813023 46 0.0942399237 47 0.1045685778 48 -0.0754551560 49 0.0543677040 50 -0.1284834231 51 -0.1389461082 52 0.0326650736 53 -0.0749234061 54 -0.0820563181 55 0.0679922231 56 -0.3363835310 57 -0.1844738606 58 -0.0710233267 59 -0.0087837920 60 -0.1312585198 61 -0.1421611969 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/15pif1256676893.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/26l841256676893.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/3qb3h1256676893.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/43ik91256676893.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/5k6981256676893.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/62wkt1256676893.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/7w7j51256676893.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/870l51256676893.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.872 2.079 2.197 2.161 2.230 2.407 > > #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/9jg151256676893.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/10znsm1256676893.tab") > > system("convert tmp/15pif1256676893.ps tmp/15pif1256676893.png") > system("convert tmp/26l841256676893.ps tmp/26l841256676893.png") > system("convert tmp/3qb3h1256676893.ps tmp/3qb3h1256676893.png") > system("convert tmp/43ik91256676893.ps tmp/43ik91256676893.png") > system("convert tmp/5k6981256676893.ps tmp/5k6981256676893.png") > system("convert tmp/62wkt1256676893.ps tmp/62wkt1256676893.png") > system("convert tmp/7w7j51256676893.ps tmp/7w7j51256676893.png") > system("convert tmp/870l51256676893.ps tmp/870l51256676893.png") > > > proc.time() user system elapsed 1.598 1.184 1.998