calculate_weighted_marginals: Calculate Weighted Marginal Distributions

View source: R/adaptive_sampling.R

calculate_weighted_marginalsR Documentation

Calculate Weighted Marginal Distributions

Description

Calculates the marginal probability distribution for each model parameter. The distributions are weighted by the likelihood of each sample, making this useful for identifying the most probable parameter values from a set of Monte Carlo samples.

Usage

calculate_weighted_marginals(samples)

Arguments

samples

A data frame containing parameter samples (e.g., log_N, log_k0) and a negative log-likelihood column named NLL.

Details

This function uses the weighted_kde helper to perform kernel density estimation for each parameter, with weights derived from the normalized likelihoods of the samples.

Value

A named list where each element is a density object (a list with x and y components) corresponding to a model parameter.

x

Vector of parameter values

y

Vector of density estimates


topolow documentation built on Aug. 31, 2025, 1:07 a.m.