Log-Likelihood of DEFM

loglike_defm(m, par, as_log = TRUE)

Arguments

m

An object of class DEFM

par

A vector of parameters of length nterms_defm(m).

as_log

Logical scalar. When TRUE (default) returns the log-likelihood, otherwise it returns the likelihood.

Value

Numeric, the computed likelihood or log-likelihood of the model.

Examples

# Loading Valtente's SNS data
data(valentesnsList)

mymodel <- new_defm(
  id    = valentesnsList$id,
  Y     = valentesnsList$Y,
  X     = valentesnsList$X,
  order = 1
)

# Adding the intercept terms and a motif from tobacco to mj
term_defm_logit_intercept(mymodel)
term_defm_transition_formula(mymodel, "{y1, 0y2} > {y1, y2}")

# Computing the log-likelihood
loglike_defm(mymodel, par = c(-1, -1, -1, 2), as_log = TRUE)
#> [1] 0