Skip to contents

This function computes the log-likelihood for a given set of parameters for different models. The models "M0", "M1", "M2" involve gamma and lambda terms, while models "M3" and "M4" involve only lambda. The function calculates the log-likelihood based on the observed data.

Usage

init.log.likelihood(
  params = rep(1, 5),
  model,
  type1,
  data1 = sim_dat$diff_Y_t[, 1],
  t = t,
  u = NULL
)

Arguments

params

A numeric vector containing initial values for the parameters. The vector should be of length 5 for models "M0", "M1", "M2", or length 3 for models "M3" and "M4".

model

A character string specifying the model type. Must be one of "M0", "M1", "M2", "M3", or "M4".

type1

A string specifying the type of distribution or model for the lambda calculation.

data1

A numeric vector containing the observed data for a single product (response variable).

t

A numeric vector of time or other covariates used in the lambda function.

u

A numeric vector of additional covariates for the lambda function (can be NULL for some models).

Value

A numeric value representing the negative log-likelihood for the given parameters.