nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
beta.hpp
Go to the documentation of this file.
1
3// toolboxes/stats/include/nk/stats/distributions/beta.hpp
4//
5// Beta distribution.
6
7#pragma once
8
9#include <memory_resource>
10#include <nk/value/value.hpp>
11
12#include <tuple>
13
14namespace nk {
15
18 namespace ops { class RngContext; } }
19
20namespace nk::stats {
21
33Value betapdf(const Value &x, double a, double b,
34 std::pmr::memory_resource *mr = nullptr);
35
47Value betacdf(const Value &x, double a, double b,
48 std::pmr::memory_resource *mr = nullptr);
49
60Value betainv(const Value &p, double a, double b,
61 std::pmr::memory_resource *mr = nullptr);
62
74Value betarnd(::nk::ops::RngContext &rng, double a, double b, size_t rows = 1, size_t cols = 1,
75 std::pmr::memory_resource *mr = nullptr);
76
87std::tuple<double, double> betastat(double a, double b);
88
99Value betafit(const Value &x, std::pmr::memory_resource *mr = nullptr);
100
106Value betafit_ci(const Value &x, double alpha = 0.05,
107 std::pmr::memory_resource *mr = nullptr);
108
109
111} // namespace nk::stats
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
std::tuple< double, double > betastat(double a, double b)
Beta mean and variance ([m, v] = betastat(a, b)).
Value betainv(const Value &p, double a, double b, std::pmr::memory_resource *mr=nullptr)
Beta inverse cdf (x = betainv(p, a, b)).
Value betacdf(const Value &x, double a, double b, std::pmr::memory_resource *mr=nullptr)
Beta cdf (p = betacdf(x, a, b)).
Value betapdf(const Value &x, double a, double b, std::pmr::memory_resource *mr=nullptr)
Beta pdf (y = betapdf(x, a, b)).
Value betafit(const Value &x, std::pmr::memory_resource *mr=nullptr)
Beta(a, b) MLE fit ([ahat, bhat] = betafit(x)).
Value betarnd(::nk::ops::RngContext &rng, double a, double b, size_t rows=1, size_t cols=1, std::pmr::memory_resource *mr=nullptr)
Beta random samples (r = betarnd(a, b, rows, cols)).
Value betafit_ci(const Value &x, double alpha=0.05, std::pmr::memory_resource *mr=nullptr)
95% Wald CI for betafit (pci = betafit_ci(x, alpha)).