draw.noncentral.chisquared: Generates variates from non-central chi-squared distribution

Description Usage Arguments Value Examples

View source: R/draw.noncentral.chisquared.R

Description

This function implements pseudo-random number generation for a non-central chi-squared distribution with pdf

f(x|λ,ν)=\frac{e^{-(x+λ)/2}x^{ν/2-1}}{2^{ν/2}} ∑_{k=0}^{∞} \frac{(λ x)^{k}}{4^{k}k!Γ(k+ν/2)}

for 0 ≤q x < ∞, λ>0, and ν>1, where λ is the non-centrality parameter and ν is the degrees of freedom.

Usage

1

Arguments

nrep

Number of data points to generate.

dof

Degrees of freedom of the desired non-central chi-squared distribution.

ncp

Non-centrality parameter of the desired non-central chi-squared distribution.

Value

A list of length five containing generated data, the theoretical mean, the empirical mean, the theoretical variance, and the empirical variance with names y, theo.mean, emp.mean, theo.var, and emp.var, respectively.

Examples

1
2
3
draw.noncentral.chisquared(nrep=100000,dof=2,ncp=1)

draw.noncentral.chisquared(nrep=100000,dof=5,ncp=2)

UnivRNG documentation built on March 6, 2021, 1:08 a.m.