cnonct {multiCA}R Documentation

Non-centrality parameter for chi-square distribution

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

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

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

[Package multiCA version 1.1 Index]