
Extract Model Statistics for fits_ids_dm Object
Source:R/extended_s3_methods.R
logLik.fits_ids_dm.Rd
These methods are wrappers to extract specific model fit statistics
(log-likelihood, AIC, BIC) for each model in a fits_ids_dm
object.
Arguments
- object
a
fits_ids_dm
object (see estimate_model_ids)- ...
additional arguments (currently not used)
- k
numeric; penalty parameter for the AIC calculation. Defaults to 2 (standard AIC).
Value
An object of type fit_stats
containing the respective statistic in
one column (named Log_Like
, AIC
, or BIC
) and a corresponding ID
column. If any of the statistics can't be calculated, the function returns
NULL
.
Details
Each function retrieves the relevant statistics by calling
calc_stats with type = "fit_stats"
and selects the columns
for ID
and the required statistic.
Examples
# get an auxiliary fits_ids object for demonstration purpose;
# such an object results from calling load_fits_ids
all_fits <- get_example_fits("fits_ids_dm")
# AICs
AIC(all_fits)
#> Type of Statistic: fit_stats
#>
#> ID AIC
#> 1 1 -785.129
#> 2 2 -741.929
#> 3 3 -931.496
#>
#> (access the data.frame's columns/rows as usual)
# BICs
BIC(all_fits)
#> Type of Statistic: fit_stats
#>
#> ID BIC
#> 1 1 -758.410
#> 2 2 -715.251
#> 3 3 -904.776
#>
#> (access the data.frame's columns/rows as usual)
# Log-Likelihoods
logLik(all_fits)
#> Type of Statistic: fit_stats
#>
#> ID Log_Like
#> 1 1 399.565
#> 2 2 377.965
#> 3 3 472.748
#>
#> (access the data.frame's columns/rows as usual)
# All unique and free parameters
coef(all_fits)
#> Object Type: coefs_dm
#>
#> ID muc b non_dec sd_non_dec tau A alpha
#> 1 1 4.700 0.446 0.341 0.032 0.032 0.102 6.605
#> 2 2 4.696 0.391 0.297 0.041 0.101 0.089 5.038
#> 3 3 5.960 0.626 0.318 0.012 0.110 0.195 3.334
#>
#> (access the data.frame's columns/rows as usual)
# Or all parameters across all conditions
coef(all_fits, select_unique = FALSE)
#> Object Type: coefs_dm
#>
#> ID Cond muc b non_dec sd_non_dec tau a A alpha peak_l
#> 1 1 comp 4.700 0.446 0.341 0.032 0.032 2 0.102 6.605 0.032
#> 2 1 incomp 4.700 0.446 0.341 0.032 0.032 2 -0.102 6.605 0.032
#> 3 2 comp 4.696 0.391 0.297 0.041 0.101 2 0.089 5.038 0.101
#> 4 2 incomp 4.696 0.391 0.297 0.041 0.101 2 -0.089 5.038 0.101
#> 5 3 comp 5.960 0.626 0.318 0.012 0.110 2 0.195 3.334 0.110
#> 6 3 incomp 5.960 0.626 0.318 0.012 0.110 2 -0.195 3.334 0.110
#>
#> (access the data.frame's columns/rows as usual)