wschisq_utils function

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

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

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

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.

Returns

  • 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.

  • Maintainer: Eduardo García-Portugués
  • License: GPL-3
  • Last published: 2024-05-24

Downloads (last 30 days):