| Chisq-class | R Documentation |
The chi-squared distribution with df= n degrees of
freedom has density
f_n(x) = \frac{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
= \lambda has density
f(x) = e^{-\lambda / 2}
\sum_{r=0}^\infty \frac{(\lambda/2)^r}{r!}\, f_{n + 2r}(x)
for x \ge 0. For integer n, this is the distribution of
the sum of squares of n normals each with variance one,
\lambda 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.
imgObject of class "Reals":
The space of the image of this distribution has got dimension 1 and the name "Real Space".
paramObject of class "ChisqParameter":
the parameter of this distribution (df and ncp), declared at its instantiation
rObject of class "function":
generates random numbers (calls function rchisq)
dObject of class "function":
density function (calls function dchisq)
pObject of class "function":
cumulative function (calls function pchisq)
qObject of class "function":
inverse of the cumulative function (calls function qchisq)
.withArithlogical: used internally to issue warnings as to interpretation of arithmetics
.withSimlogical: used internally to issue warnings as to accuracy
.logExactlogical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function
.lowerExactlogical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function
Symmetryobject of class "DistributionSymmetry";
used internally to avoid unnecessary calculations.
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@uni-oldenburg.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.
## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.)
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.