R/logLik.arx.R

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
logLik.arx <-
function(object, ...)
{
  if( is.null(object$aux$user.estimator) ){

    resids <- residuals.arx(object, std=FALSE)
    sdhat <- sqrt(fitted.arx(object, spec="variance"))
    sdhat <- na.trim(sdhat)
    resids <- window(resids, start=index(sdhat)[1],
      end=index(sdhat)[length(sdhat)])
    result <- sum(dnorm(resids, sd=sdhat, log=TRUE))
    attr(result, "df") <- length(coef.arx(object, spec="mean"))
    attr(result, "nobs") <- length(sdhat)
    class(result) <- "logLik"

  }else{

    result <- object$logl
    if( !is.null(result) ){
      attr(result, "df") <- length(object$coefficients)
      if( !is.null(objects$resids) ){
        attr(result, "nobs") <- length(na.trim(objects$resids))
      }
      class(result) <- "logLik"
    }
    
  }
  
  return(result)
}

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.