Skip to contents

This function computes the log-likelihood for a specified model (M4 model) using the provided parameter estimates (`hat_para`) and data (`data`). The log-likelihood is calculated based on a statistical model where each data point is assumed to follow a specific distribution defined by the `Lambda_fun` function, which is related to the parameter estimates.

Usage

M4.loglik(hat_para, types, data = sim_dat$diff_Y_t, t_list = t_list)

Arguments

hat_para

A vector of parameter estimates. The first two elements correspond to the initial parameters used in the `Lambda_fun`, and the third element corresponds to another model parameter involved in the likelihood computation.

types

A vector specifying the types or categories associated with each series, passed to the `Lambda_fun` function for calculating the time-varying function.

data

A matrix or data frame containing the data points for each series. Rows correspond to observations, and columns represent different time series.

t_list

A list of time points (or other relevant sequence) for each series, passed to the `Lambda_fun` for time-specific calculations.

Value

A numeric value representing the negative log-likelihood of the data under the specified model. The function returns the negative value to facilitate optimization (minimization).

Details

The log-likelihood is calculated by iterating through each data column and computing the contribution to the log-likelihood based on the given parameters and the likelihood function for each time series.