
Evaluate the log-likelihood of behavioral data
Source:R/likelihood_param_interface.R
log_likelihood.RdCompute the log-likelihood of prepared behavioral data under one or more candidate parameter sets.
Arguments
- context
Context created with `make_context()`.
- data
Prepared data created with `prepare_data()`.
- parameters
A parameter data frame, or a list of parameter data frames.
- ok
Logical vector marking which trials should contribute to the likelihood. Trials marked `FALSE` are assigned `min_ll`.
- expand
Optional index vector used to expand compressed trial-level results back to the original trial count.
- min_ll
Minimum log-likelihood value used for excluded or impossible trials.
- ...
Unused; for S3 compatibility.
Examples
spec <- race_spec()
spec <- add_accumulator(spec, "A", "lognormal")
spec <- add_outcome(spec, "A_win", "A")
structure <- finalize_model(spec)
params_df <- build_param_matrix(
spec,
c(A.m = 0, A.s = 0.1, A.q = 0, A.t0 = 0),
n_trials = 2
)
data_df <- simulate(structure, params_df, seed = 1)
prepared <- prepare_data(structure, data_df)
ctx <- make_context(structure)
log_likelihood(ctx, prepared, list(params_df))
#> [1] 2.481128