dchisq(x, df, ncp = 0, log = FALSE) # density pchisq(q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE) # probability qchisq(p, df, ncp = 0, lower.tail = TRUE, log.p = FALSE) # quantile rchisq(n, df, ncp = 0) # random
x, q | numeric vectors in the range [0, Inf) that specify the quantiles. |
p | a numeric vector in the range [0, 1] that specifies the probabilities. |
n | an integer scalar in the range [0, Inf) that specifies the number of random samples requested. If the input value is not an integer, it is truncated. If length(n) is greater than 1, the random function returns length(n) random samples. |
df | a numeric vector in the range [0, Inf) that specifies the degree of freedom. |
ncp | a numeric vector in the range [0, Inf) that specifies the noncentrality parameter. |
log | a logical value. If FALSE (default), the density function returns the density itself. If TRUE, it returns the log of the density. |
lower.tail | a logical value. If TRUE (default), the probability supplied to the quantile function or returned by the probability function is P[X <= x]. If FALSE, it is P[X > x]. |
log.p | a logical value. If FALSE (default), the probability supplied to the quantile function or returned by the probability function is the probability itself. If TRUE, it is the log of the probability. |
# two ways to calculate p-value for stat stat <- 20; df <- 8 1 - pchisq(stat, df) pchisq(stat, df, lower.tail = FALSE)# power of a test for several noncentrality values 1 - pchisq(qchisq(.95, 8), 8, 0:10)