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(4.737,7.302,18.190,9.585,-5.215,-325,-8.722,-8.968,-4.865,256,-6.501,-15.030,11.003,4.997,11.527,6.707,-585,7.413,-5.329,-4.067,-1.880,-1.751,-4.443,-18.995,18.270,14.437,24.234,9.792,9.288,4.784,-2.451,-4.430,-2.962,992,-7.543,-21.907,13.324,5.484,14.637,2.544,732,2.812,-3.216,-8.338,-7.438,876,-10.242,-22.632,11.009,9.413,9.499,13.906,-1.119,1.829,-5.765,-11.716,-8.062,-3.843,-16.849,-24.390) > x <- c(162.3990575,-740.4671903,620.335323,-658.1934026,-569.2571371,967.9403496,-829.8810134,-1046.154801,-673.4223055,-171.1548011,-755.8810134,-447.0147656,-599.4797568,-307.2122523,498.4565088,242.9277831,1087.730296,918.462792,-673.4923232,100.437659,349.5714113,-53.28855329,-264.0147656,970.71773,982.2527388,300.6539955,1393.991518,214.7940309,682.9277831,891.9277831,-214.358571,-121.1610843,177.641429,565.9214999,-518.1359514,-10.93218141,87.53280973,-391.8621637,558.411624,-333.7858627,-370.7795795,648.8254471,-329.664677,-83.00219913,-779.9258982,984.0803851,-241.6458272,-671.1808361,-116.5820928,343.6216772,-26.37203958,143.0292171,-254.1619864,405.6342437,-631.0533671,-770.8558804,-108.715845,-454.1108184,-363.5758095,280.5516595) > 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 -30.15196 2 -13.75444 3 -23.71486 4 -12.73193 5 -28.89449 6 -372.23041 7 -28.40856 8 -25.34109 9 -26.94861 10 226.22131 11 -27.32129 12 -40.58233 13 -12.21346 14 -22.69720 15 -28.51059 16 -29.41572 17 -634.06567 18 -39.05938 19 -27.41154 20 -38.00667 21 -39.63657 22 -33.33548 23 -32.79901 24 -66.26796 25 -29.17968 26 -22.57012 27 -29.52380 28 -25.89969 29 -33.57582 30 -41.28184 31 -31.56778 32 -34.97463 33 -38.08449 34 950.92880 35 -32.00570 36 -54.14041 37 -20.41796 38 -20.91330 39 -26.31915 40 -24.74307 41 705.27970 42 -39.52935 43 -30.56621 44 -39.46725 45 -27.88990 46 828.52232 47 -38.94072 48 -44.74995 49 -19.60578 50 -28.25242 51 -22.49786 52 -20.68621 53 -29.62596 54 -36.78649 55 -28.49773 56 -32.30686 57 -38.79730 58 -29.28661 59 -43.67967 60 -61.08914 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ycjh1257334120.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/2o2hi1257334120.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/3ah6n1257334120.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/48fld1257334120.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/5t99s1257334120.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/6wzyc1257334120.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/7t6hc1257334120.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/86csu1257334120.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.046e+03 -4.488e+02 -9.586e+01 3.333e-10 3.636e+02 1.394e+03 > > #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/934331257334120.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/101jzg1257334120.tab") > > system("convert tmp/1ycjh1257334120.ps tmp/1ycjh1257334120.png") > system("convert tmp/2o2hi1257334120.ps tmp/2o2hi1257334120.png") > system("convert tmp/3ah6n1257334120.ps tmp/3ah6n1257334120.png") > system("convert tmp/48fld1257334120.ps tmp/48fld1257334120.png") > system("convert tmp/5t99s1257334120.ps tmp/5t99s1257334120.png") > system("convert tmp/6wzyc1257334120.ps tmp/6wzyc1257334120.png") > system("convert tmp/7t6hc1257334120.ps tmp/7t6hc1257334120.png") > system("convert tmp/86csu1257334120.ps tmp/86csu1257334120.png") > > > proc.time() user system elapsed 1.578 1.184 2.846