InvChisquare {geoR} | R Documentation |
The (Scaled) Inverse Chi-Squared Distribution
Description
Density and random generation for the scaled inverse chi-squared
() distribution with
df
degrees of freedom and optional non-centrality parameter
scale
.
Usage
dinvchisq(x, df, scale, log = FALSE)
rinvchisq(n, df, scale = 1/df)
Arguments
x |
vector of quantiles. |
n |
number of observations. If |
df |
degrees of freedom. |
scale |
scale parameter. |
log |
logical; if TRUE, densities d are given as log(d). |
Details
The inverse chi-squared distribution with df
degrees of freedom has density
for .
The mean and variance are
and
.
The non-central chi-squared distribution with df
degrees of freedom and non-centrality parameter
scale
has density
,
for .
The first is a particular case of the latter for
.
Value
dinvchisq
gives the density and rinvchisq
generates random deviates.
See Also
rchisq
for the chi-squared distribution which
is the basis for this function.
Examples
set.seed(1234); rinvchisq(5, df=2)
set.seed(1234); 1/rchisq(5, df=2)
set.seed(1234); rinvchisq(5, df=2, scale=5)
set.seed(1234); 5*2/rchisq(5, df=2)
## inverse Chi-squared is a particular case
x <- 1:10
all.equal(dinvchisq(x, df=2), dinvchisq(x, df=2, scale=1/2))