wschisq_utils: Utilities for weighted sums of non-central chi squared random...

wschisq_utilsR Documentation

Utilities for weighted sums of non-central chi squared random variables

Description

Simulation from a weighted sum of non-central chi squared random variables and Monte Carlo approximation of its distribution function.

Usage

r_wschisq_Cpp(n, weights, dfs, ncps)

p_wschisq_MC(x, weights = 0L, dfs = 0L, ncps = 0L, M = 10000L,
  sample = 0L, use_sample = FALSE, x_sorted = FALSE)

Arguments

n

sample size.

weights

vector with the positive weights of the sum. Must have the same length as dfs.

dfs

vector with the positive degrees of freedom of the chi squared random variables. Must have the same length as weights.

ncps

non-negative non-centrality parameters. A vector with the same length as weights.

x

vector of quantiles.

M

number of Monte Carlo samples for approximating the distribution. Defaults to 1e4.

sample

if use_sample = TRUE, the Monte Carlo sample to approximate the distribution. If not, it is computed internally. Defaults to 1e4.

use_sample

use the already computed sample? If FALSE (default), sample is computed internally.

Value

  • r_wschisq_Cpp: a matrix of size c(n, 1) containing a random sample.

  • p_wschisq_MC: a matrix of size c(nx, 1) with the evaluation of the distribution function at x.


sphunif documentation built on Aug. 21, 2023, 9:11 a.m.