draw.noncentral.chisquared {UnivRNG} | R Documentation |
Generates variates from non-central chi-squared distribution
Description
This function implements pseudo-random number generation for a non-central chi-squared distribution with pdf
f(x|\lambda,\nu)=\frac{e^{-(x+\lambda)/2}x^{\nu/2-1}}{2^{\nu/2}} \sum_{k=0}^{\infty} \frac{(\lambda x)^{k}}{4^{k}k!\Gamma(k+\nu/2)}
for 0 \leq x < \infty
, \lambda>0
, and \nu>1
, where \lambda
is the non-centrality parameter and \nu
is the degrees of freedom.
Usage
draw.noncentral.chisquared(nrep,dof,ncp)
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
draw.noncentral.chisquared(nrep=100000,dof=2,ncp=1)
draw.noncentral.chisquared(nrep=100000,dof=5,ncp=2)