histo: histo

Description Usage Arguments Author(s) See Also Examples

Description

Given one-dimensional data dat and bins bins, evaluate the histogram function at x:

\text{hist}(x) := ∑_{k = 1}^{m} \Big[ \frac{I(x \in B_k)}{n(u_k - u_{k - 1})} ∑_{i = 1}^{n} I(x_i \in B_k) \Big]

Usage

1
histo(x, dat, bins)

Arguments

x

A number, or vector of numbers.

dat

A vector of numbers.

bins

A vector of numbers where min(bins) <= min(dat) and max(bins) > max(dat).

Author(s)

Junkyu Park

See Also

csum_N, dpmf, rpmf, Evaluating a hard-to-evaluate pmf using pgf and DFT

Examples

1
2
3
4
5
6
7
8
# Example: dX in csum_N
# Evaluate the histogram of 10000 samples of S = sum of iid X_i ~ dX
# at 0, 1, ..., M - 1 for some integer M, where the endpoints of bins are
# set to be seq(-.5, M - .5, by = 1).
result_X <- csum_N(dX, support = 0:5, lambda = 3)
M <- length(result_X)
samples_N <- rpmf(10000, dpmf, 0:(M - 1), result_X)
histo(0:(M - 1), samples_N, seq(-.5, M - .5, by = 1))

joon3216/funpark documentation built on June 18, 2019, 7:32 a.m.