Learn R Programming

PoweR (version 1.0.7)

law0009.Chisquared: The Chi-Squared Distribution

Description

Random generation for the Chi-squared distribution with df degrees of freedom.

This generator is called by function gensample to create random variables based on its parameter.

Arguments

Details

If df is not specified it assumes the default value of 1.

The Chi-squared distribution with df = k degrees of freedom has density: $$ 2^{-k/2}\Gamma(k/2)^{-1}x^{k/2-1}e^{-x/2} $$ for \(x > 0\) and \(k \ge 1\). The mean and variance are \(n\) and \(2n\).

References

Pierre Lafaye de Micheaux, Viet Anh Tran (2016). PoweR: A Reproducible Research Tool to Ease Monte Carlo Power Simulation Studies for Studies for Goodness-of-fit Tests in R. Journal of Statistical Software, 69(3), 1--42. doi:10.18637/jss.v069.i03

See Also

Distributions for other standard distributions.

Examples

Run this code
# NOT RUN {
res <- gensample(9,10000,law.pars=8)
res$law
res$law.pars
mean(res$sample)
sd(res$sample)
# }

Run the code above in your browser using DataLab