cnonct: Non-centrality parameter for chi-square distribution

Description Usage Arguments Details Examples

View source: R/multiCA.R

Description

Calculates the non-centrality parameter for a chi-square distribution for a given quantile. This is often needed for sample size calculation for chi-square based tests.

Usage

1
cnonct(x, p, df)

Arguments

x

a numeric value at which the distribution was evaluated

p

a numeric value giving the cumulative probability at x

df

an integer giving the degrees of freedom of the chi-square variable

Details

The function is modeled after the SAS function CNONCT. If p is larger than the cumulative probability of the central chi-square distribution at x, then there is no solution and NA is returned.

Examples

1
2
3
(ncp <- cnonct(qchisq(0.95, df=10), 0.8, df=10))
## check
pchisq(qchisq(0.95, df=10), df=10, ncp=ncp)  ## 0.8

multiCA documentation built on May 2, 2019, 4:51 p.m.