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(4.593502381,4.600207894,4.606868743,4.593502381,4.620157316,4.626540212,4.628789052,4.630252966,4.633271616,4.639281716,4.640247713,4.641405679,4.639571613,4.639281716,4.639088404,4.639378357,4.643717596,4.643332647,4.648229675,4.651958347,4.651767471,4.65519768,4.65643348,4.653579325,4.651576559,4.654055584,4.655387902,4.6558633,4.661266925,4.661361466,4.665888921,4.664664758,4.664570529,4.668802046,4.667581446,4.668520501,4.673762977,4.683056725,4.685828089,4.689878914,4.69701984,4.704291277,4.7065528,4.71545854,4.720995751,4.726236714,4.720104724,4.721708002,4.719926423,4.713934901,4.711779921,4.712768197,4.716174744,4.710430697,4.712498764,4.711779921,4.709890497,4.709259895,4.712319102,4.709710365) > x <- c(5.033048889,4.976733742,4.925077406,4.999237249,5.025195445,5.132262782,5.127529046,5.08202529,5.159629847,5.187385806,5.250176991,5.247024072,5.201806466,5.163642463,5.195730778,5.282187985,5.266826699,5.283203729,5.376666333,5.39997102,5.384036242,5.43677411,5.426710581,5.319099906,5.281171208,5.292299294,5.33513134,5.250701513,5.306285536,5.349485653,5.409411414,5.410752796,5.443283137,5.497168225,5.458308103,5.522260598,5.582367853,5.661570626,5.646506407,5.68833037,5.743964264,5.810542011,5.851340039,5.948557046,6.009058856,6.024899323,5.893576046,5.774240938,5.478135793,5.252273428,5.073297055,5.096201182,5.060060177,5.113191882,5.174453379,5.289781036,5.421419564,5.376203905,5.463407986,5.424509392) > 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.046667914 2 -0.035137820 3 -0.024051515 4 -0.043771233 5 -0.019340165 6 -0.022129846 7 -0.019475462 8 -0.014113191 9 -0.017743009 10 -0.014110793 11 -0.018524186 12 -0.017096106 13 -0.015056330 14 -0.012076674 15 -0.015019028 16 -0.022135959 17 -0.016480702 18 -0.018268689 19 -0.021378706 20 -0.019646572 21 -0.018472298 22 -0.019560200 23 -0.017462247 24 -0.011097276 25 -0.009850649 26 -0.008324979 27 -0.010662130 28 -0.002953535 29 -0.002311855 30 -0.005918316 31 -0.006524767 32 -0.007863848 33 -0.010744987 34 -0.011129865 35 -0.009021275 36 -0.013561101 37 -0.013468080 38 -0.010959721 39 -0.006897789 40 -0.006430069 41 -0.004055360 42 -0.002487712 43 -0.003721402 44 -0.003144350 45 -0.002790396 46 0.001093497 47 0.006212117 48 0.018038966 49 0.041625042 50 0.054983398 51 0.068161522 52 0.067187576 53 0.073690363 54 0.063394464 55 0.060214191 56 0.049615100 57 0.036448058 58 0.039691131 59 0.035279468 60 0.036003217 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1kold1257169351.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/28kog1257169351.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/3wit81257169351.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/46oxq1257169351.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/571oj1257169352.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/602hq1257169352.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/7r1io1257169352.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/8g5ou1257169352.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.925 5.184 5.327 5.372 5.467 6.025 > > #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/9rlvw1257169352.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/10g1k91257169352.tab") > > system("convert tmp/1kold1257169351.ps tmp/1kold1257169351.png") > system("convert tmp/28kog1257169351.ps tmp/28kog1257169351.png") > system("convert tmp/3wit81257169351.ps tmp/3wit81257169351.png") > system("convert tmp/46oxq1257169351.ps tmp/46oxq1257169351.png") > system("convert tmp/571oj1257169352.ps tmp/571oj1257169352.png") > system("convert tmp/602hq1257169352.ps tmp/602hq1257169352.png") > system("convert tmp/7r1io1257169352.ps tmp/7r1io1257169352.png") > system("convert tmp/8g5ou1257169352.ps tmp/8g5ou1257169352.png") > > > proc.time() user system elapsed 1.890 1.790 3.511