Skip to contents

This function loads the results of a fit procedure where a model was fitted to multiple individuals (see estimate_model_ids). It is also the function that creates an object of type fits_ids_dm.

Usage

load_fits_ids(
  path = "drift_dm_fits",
  fit_procedure_name = "",
  detailed_info = FALSE,
  check_data = TRUE,
  progress = 2
)

# S3 method for class 'fits_ids_dm'
print(x, ...)

Arguments

path

character, a path pointing to a folder or directory containing the individual model fits.

fit_procedure_name

character, an optional name that identifies the fit procedure that should be loaded

detailed_info

logical, controls the amount of information displayed in case multiple fit procedures were found and the user is prompted to explicitly choose one

check_data

logical, should the data be checked before passing them back? This checks the observed data and the properties of the model. Default is TRUE

progress

numerical, indicating if and how progress shall be depicted. If 0, no progress is shown. If 1, basic infos about the checking progress is shown. If 2, multiple progressbars are shown. Default is 2.

x

an object of type fits_ids_dm, created when calling load_fits_ids

...

additional arguments

Value

For load_fits_ids(), an object of type fits_ids_dm, which essentially is a list with two entries:

  • drift_dm_fit_info, containing a list of the main arguments when estimate_model_ids was originally called, including a time-stamp.

  • all_fits, containing a list of all the modified/fitted drift_dm objects. The list's entry are named according to the individuals' identifier (i.e., ID).

For print.fits_ids_dm(), the supplied fit_ids_dm object x (invisible return).

Details

with respect to the logic outlined in the details of estimate_model_ids on the organization of fit procedures, path could either point to a directory with (potentially) multiple fit routines or to a specific folder with the individual fits. In either case the intended location is recursively searched for files named drift_dm_fit_info.rds.

If the fit procedure was uniquely located, either because only one fit routine was found in the intended location or because only one drift_dm_fit_info.rds contains the optional identifier specified in fit_procedure_name, then all individual model fits including the information fit_procedure_name are loaded and returned.

In case multiple fit procedures are identified, the user is prompted with a utils::menu, listing information about the possible candidates. The intended fit procedure can then interactively be chosen by the user. The amount of displayed information is controlled via detailed_info.

The print() method for objects of type fits_ids_dm prints out basic information about the fit procedure name, the fitted model, time of (last) call, and the number of individual data sets.

Examples

# -------------------------------------------------------------------------
# We stored a fit procedure (matching with the example for
# estimate_model_ids()) within the package to easily access it here.
# -------------------------------------------------------------------------

# get the path to the fit procedures' location
# -> if a user saved fit procedures in their working directory,
#    path_to would just be "drift_dm_fits" (see the default value of path)
path_to <- file.path(
  system.file(package = "dRiftDM"), "drift_dm_fits"
)

# then load all the fits of a fit procedure
all_fits <- load_fits_ids(path = path_to, fit_procedure_name = "example")
print(all_fits)
#> Fit procedure name: example
#> Fitted model type: ratcliff_dm, drift_dm
#> Time of (last) call: 2024-Dezember-27_16-41
#> N Individuals: 2 
summary(all_fits)
#> Fit procedure name: example
#> N Individuals: 2 
#> 
#> Parameter summary: null 
#>           muc     b non_dec
#> mean    3.000 0.759   0.395
#> std_err 0.545 0.170   0.172
#> 
#> 
#> Parameter space:
#>       muc   b non_dec
#> lower   1 0.2     0.1
#> upper   7 1.0     0.6
#> 
#> -------
#> Fitted model type: ratcliff_dm, drift_dm
#> Time of (last) call: 2024-Dezember-27_16-41