Learn R Programming

topolow (version 2.0.1)

weighted_kde: Weighted Kernel Density Estimation

Description

Performs weighted kernel density estimation for univariate data. This is useful for analyzing parameter distributions where each sample has an associated importance weight (e.g., a likelihood).

Usage

weighted_kde(x, weights, n = 512, from = min(x), to = max(x))

Value

A list containing the evaluation points (x) and the estimated density values (y).

Arguments

x

A numeric vector of samples.

weights

A numeric vector of weights corresponding to each sample in x.

n

The integer number of points at which to evaluate the density.

from, to

The range over which to evaluate the density.