View source: R/pmsims_objective_function.R
| objective_function | R Documentation |
Computes the objective value
\left| M(n) - M^* - \lambda\,C(n) \right|,
where M(n) is performance at sample size n, M^* is the
target performance, C(n) is a cost term increasing with n, and
\lambda (set via penalty_weight) controls the penalty on large samples.
objective_function(
n,
penalty_weight,
target_performance,
min_sample_size,
max_sample_size,
value_on_error,
data_function = NULL,
model_function = NULL,
metric_function = NULL
)
n |
Integer sample size. |
penalty_weight |
Penalty weight |
target_performance |
Target performance |
min_sample_size |
Minimum sample size considered (lower bound of search). |
max_sample_size |
Maximum sample size considered (upper bound of search). |
value_on_error |
Value to return if the objective cannot be evaluated. |
data_function |
Data generator passed to |
model_function |
Model-fitting function passed to |
metric_function |
Metric function passed to |
A single numeric: the objective value at n.
# Example usage (assuming helper functions exist):
# objective_function(
# n = 500,
# penalty_weight = 0.1,
# target_performance = 0.75,
# min_sample_size = 100,
# max_sample_size = 5000,
# value_on_error = Inf
# )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.