Skip to content

Commit

Permalink
logLik + df.residual correction
Browse files Browse the repository at this point in the history
  • Loading branch information
AQLT committed Apr 20, 2024
1 parent 2a86c87 commit 136e61b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions R/regarima_generic.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ logLik.JD3_REGARIMA_RSLTS <- function(object, ...) {
is.null(object$likelihood$ll)) {
res <- NA
} else{
res <- structure(object$likelihood$ll,
df = object$likelihood$nparams + 1,
nall = object$likelihood$nobs,
nobs = object$likelihood$neffectiveobs)
res <- structure(
object$likelihood$ll,
# df already contains variance of innovations
# so we didn't add +1 as in stats:::logLik.Arima()
df = object$likelihood$nparams,
nall = object$likelihood$nobs,
nobs = object$likelihood$neffectiveobs)
}
class(res) <- "logLik"
res
Expand All @@ -56,8 +59,8 @@ df.residual.JD3_REGARIMA_RSLTS <- function(object, ...){
return(NULL)
if (!is.null(object$estimation)) # for sarima_estimate outputs
object <- object$estimation

object$likelihood$neffectiveobs - object$likelihood$nparams
# Remove variance of innovations from parameters
object$likelihood$neffectiveobs - (object$likelihood$nparams - 1)
}
#' @export
nobs.JD3_REGARIMA_RSLTS <- function(object, ...){
Expand Down

0 comments on commit 136e61b

Please sign in to comment.