Chisquare                package:base                R Documentation

_T_h_e (_n_o_n-_c_e_n_t_r_a_l) _C_h_i-_S_q_u_a_r_e_d _D_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Density, distribution function, quantile function and random
     generation for the chi-squared (chi^2) distribution with `df'
     degrees of freedom and optional non-centrality parameter `ncp'.

_U_s_a_g_e:

     dchisq(x, df, ncp=0, log = FALSE)
     pchisq(q, df, ncp=0, lower.tail = TRUE, log.p = FALSE)
     qchisq(p, df, ncp=0, lower.tail = TRUE, log.p = FALSE)
     rchisq(n, df, ncp=0)

_A_r_g_u_m_e_n_t_s:

    x, q: vector of quantiles.

       p: vector of probabilities.

       n: number of observations. If `length(n) > 1', the length is
          taken to be the number required.

      df: degrees of freedom.

     ncp: non-centrality parameter.  For `rnchisq', `ncp=0' is the only
          possible value.

log, log.p: logical; if TRUE, probabilities p are given as log(p).

lower.tail: logical; if TRUE (default), probabilities are P[X <= x],
          otherwise, P[X > x].

_D_e_t_a_i_l_s:

     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' = lambda has density

 f(x) = exp(-lambda/2) SUM_{r=0}^infty ((lambda/2)^r / r!) dchisq(x, df + 2r)

     for x >= 0.  It 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.

_V_a_l_u_e:

     `dchisq' gives the density, `pchisq' gives the distribution
     function, `qchisq' gives the quantile function, and `rchisq'
     generates random deviates.

_S_e_e _A_l_s_o:

     `dgamma' for the Gamma distribution which generalizes the
     chi-squared one.

_E_x_a_m_p_l_e_s:

     dchisq(1, df=1:3)
     pchisq(1, df= 3)
     pchisq(1, df= 3, ncp = 0:4)# includes the above

     x <- 1:10
     ## Chi-squared(df = 2) is a special exponential distribution
     all.equal(dchisq(x, df=2), dexp(x, 1/2))
     all.equal(pchisq(x, df=2), pexp(x, 1/2))

