Describing an evaluated population
CalcMarginals provides descriptive analysis of an evaluated Sim::OPT population. It calculates the empirical marginal distribution of each selected discrete variable and, separately, response distributions conditional on each level of that variable.
The procedure is descriptive: it reports how the evaluated population is distributed. It does not by itself establish causal effects or sensitivity.
Variable marginals
For each selected variable, CalcMarginals counts how many evaluated instances contain each level and reports both counts and percentages. Unequal sampling is retained rather than silently reweighted.
Conditional response distributions
A selected numerical response is divided into intervals between configured best and worst values. For each variable level, CalcMarginals records the response histogram as raw counts and as an independently normalized percentage distribution.
Rows whose response lies outside the configured interval are counted separately as better-than-best or worse-than-worst. Rows with a nonnumeric response still contribute to variable marginals but are omitted from numerical response histograms.
Configuration and use
use Sim::OPT::CalcMarginals qw(run_config);
my $result = run_config('marginals_config.pl');
A configuration specifies the source file, selected variables and levels, response column, number of divisions, best and worst values, and optionally an output directory. Relative paths used through run_config are resolved from the configuration-file directory.
Outputs
The procedure writes variable marginals, response-distribution counts and response-distribution percentages to separate CSV files and also returns a structured summary to the caller.