Chisq-class {distr} | R Documentation |
The chi-squared distribution with df
= n degrees of
freedom has density
f_n(x) = 1 / (2^(n/2) Gamma(n/2)) x^(n/2-1) e^(-x/2)
for x > 0. The mean and variance are n and 2n.
The non-central chi-squared distribution with df
= n
degrees of freedom and non-centrality parameter ncp
= λ has density
f(x) = exp(-lambda/2) SUM_{r=0}^infty ((lambda/2)^r / r!) dchisq(x, df + 2r)
for x >= 0. For integer n, this is the distribution of the sum of squares of n normals each with variance one, λ being the sum of squares of the normal means.
C.f. rchisq
Objects can be created by calls of the form Chisq(df, ncp)
.
This object is a chi-squared distribution.
img
:"Reals"
:
The space of the image of this distribution has got dimension 1 and the name "Real Space".param
:"ChisqParameter"
:
the parameter of this distribution (df and ncp), declared at its instantiationr
:"function"
:
generates random numbers (calls function rchisq)d
:"function"
:
density function (calls function dchisq)p
:"function"
:
cumulative function (calls function pchisq)q
:"function"
:
inverse of the cumulative function (calls function qchisq)
Class "ExpOrGammaOrChisq"
, directly.
Class "AbscontDistribution"
, by class "ExpOrGammaOrChisq"
.
Class "UnivariateDistribution"
, by class "AbscontDistribution"
.
Class "Distribution"
, by class "UnivariateDistribution"
.
By means of setIs
, R ``knows'' that a distribution object obj
of class "Chisq"
with non-centrality 0 also is
a Gamma distribution with parameters shape = df(obj)/2, scale = 2
.
signature(.Object = "Chisq")
: initialize method signature(object = "Chisq")
:
returns the slot df of the parameter of the distribution signature(object = "Chisq")
:
modifies the slot df of the parameter of the distribution signature(object = "Chisq")
:
returns the slot ncp of the parameter of the distribution signature(object = "Chisq")
:
modifies the slot ncp of the parameter of the distribution signature(e1 = "Chisq", e2 = "Chisq")
:
For the chi-squared distribution we use its closedness under convolutions.Warning: The code for pchisq and qchisq is unreliable for values of ncp above approximately 290.
Thomas Stabla statho3@web.de,
Florian Camphausen fcampi@gmx.de,
Peter Ruckdeschel Peter.Ruckdeschel@itwm.fraunhofer.de,
Matthias Kohl Matthias.Kohl@stamats.de
ChisqParameter-class
AbscontDistribution-class
Reals-class
rchisq
C <- Chisq(df = 1, ncp = 1) # C is a chi-squared distribution with df=1 and ncp=1. r(C)(1) # one random number generated from this distribution, e.g. 0.2557184 d(C)(1) # Density of this distribution is 0.2264666 for x = 1. p(C)(1) # Probability that x < 1 is 0.4772499. q(C)(.1) # Probability that x < 0.04270125 is 0.1. df(C) # df of this distribution is 1. df(C) <- 2 # df of this distribution is now 2. is(C, "Gammad") # no C0 <- Chisq() # default: Chisq(df=1,ncp=0) is(C0, "Gammad") # yes as(C0,"Gammad")