Updates the PDFs of a model. If obs_data are set to the model, the log-likelihood is also updated.
Arguments
- drift_dm_obj
an object of type drift_dm
- eval_model
logical, indicating if the model should be evaluated or not. If
False
, PDFs and the log-likelihood value are deleted from the model. Default isTrue
.
Value
Returns the passed drift_dm_obj
object, after (re-)calculating
the PDFs and (if observed data is set) the log-likelihood.
the PDFs an be addressed via
drift_dm_obj$pdfs
the log-likelihood can be addressed via
drift_dm_obj$log_like_val
Note that if re_evaluate
model is called before observed data was set,
the function silently updates the pdfs
, but not log_like_val
.
Details
More in-depth information about the mathematical details for deriving the PDFs can be found in Richteretal.2023;textualdRiftDM
Examples
# choose a pre-built model (e.g., the Ratcliff model)
# and set the discretization as needed
my_model <- ratcliff_dm(t_max = 1.5, dx = .005, dt = .005)
# then calculate the model's predicted PDF
my_model <- re_evaluate_model(my_model)
str(my_model$pdfs) # show the structure of the attached pdfs
#> List of 1
#> $ null:List of 2
#> ..$ pdf_u: num [1:301] 1e-10 1e-10 1e-10 1e-10 1e-10 ...
#> ..$ pdf_l: num [1:301] 1e-10 1e-10 1e-10 1e-10 1e-10 ...
# if you want the log_likelihood, make sure some data is attached to the
# model (see also the documentation of obs_data())
obs_data(my_model) <- ratcliff_synth_data # this data set comes with dRiftDM
my_model <- re_evaluate_model(my_model)
str(my_model$pdfs)
#> List of 1
#> $ null:List of 2
#> ..$ pdf_u: num [1:301] 1e-10 1e-10 1e-10 1e-10 1e-10 ...
#> ..$ pdf_l: num [1:301] 1e-10 1e-10 1e-10 1e-10 1e-10 ...
print(my_model$log_like_val)
#> [1] 201.0686