R/logLikelihoodObservedOnly.R

Defines functions logLikelihoodObservedOnly

# (O)bserved (Only)
logLikelihoodObservedOnly = function(specs, variables, data) {

  return(rowSums(
    vapply(
      X = specs$observedVariables,
      FUN = function(x, variables, data) {
        return(variables[[x]]$likelihood(
          data = data,
          log = TRUE
        ))
      },
      FUN.VALUE = as.numeric(rep(NA, nrow(data))),
      variables = variables,
      data = data
    ),
    na.rm = TRUE
  ))



}

Try the blatent package in your browser

Any scripts or data that you put into this service are public.

blatent documentation built on May 29, 2024, 5:42 a.m.