new_stats_dm: Create a New stats_dm Object

View source: R/core_stats.R

new_stats_dmR Documentation

Create a New stats_dm Object

Description

new_stats_dm initializes a stats_dm object to label statistic types and store necessary attributes for the custom methods (such as ⁠plot_*⁠)

Usage

new_stats_dm(stat_df, type, ...)

Arguments

stat_df

a data.frame, containing calculated statistics to be encapsulated within the stats_dm class.

type

a character string, specifying the type of statistic provided by stat_df. Valid options include "cafs", "quantiles", "delta_funs", and "fit_stats".

...

Additional arguments passed to set attributes. For "cafs", "quantiles", and "delta_funs", a b_coding attribute is required.

Details

new_stats_dm sets up the stat_df object by assigning it the class stats_dm, along with additional classes based on the specified type. For"cafs", "quantiles", "delta_funs", this will be c(⁠<type>⁠, "sum_dist", "stats_dm", "data.frame")". For fit statistics, this will be c("fit_stats", "stats_dm", "data.frame")".

For Conditional Accuracy Functions (CAFs), Quantiles, and Delta Functions, the function requires a b_coding argument, which specifies boundary coding details and is set as an attribute.

The function performs validation through validate_stats_dm to ensure that the stats_dm object is well formatted.

Value

An object of class stats_dm, with additional classes and attributes depending on type.


dRiftDM documentation built on April 3, 2025, 7:48 p.m.