# ncpci

non centrality parameter confidence interval (taken from effect_of_size_toolbox)

## Syntax

• ci=ncpci(x,fType,df)example
• ci=ncpci(x,fType,df,Name,Value)example

## Description

This function creates (using iteration) a two-sided confidence intervals for the noncentrality parameter of a noncentral $\chi^2$, $F$ or $t$ distribution with degrees of freedom $df$, given an abscissa value $x$.

This function has been taken from the MATLAB toolbox 'Measures of effect Size' by Harald Hentschke and Maik C. Stüttgen.

https://www.mathworks.com/matlabcentral/fileexchange/32398-hhentschke-measures-of-effect-size-toolbox and has been slighlty modified to be included into the FSDA toolbox.

 ci =ncpci(x, fType, df) ncpci with all the default values.

 ci =ncpci(x, fType, df, Name, Value) ncpci with option confint.

## Examples

expand all

### ncpci with all the default values.

Suppose that in a contingency table of size 3-times-4 the value of the chi square test is 52. Suppose we want to compute a confidence interval for the non centrality parameter of the chi^2 with (3-1)(4-1)=8 degrees of freedom.

    ci=ncpci(52,'X2',8);
disp('Confidence interval for the non centrality parameter')
disp(ci)

Confidence interval for the non centrality parameter
43.5345   76.2004



### ncpci with option confint.

A 99 per cent confidence interval is requested.

    confint=0.99;
ci=ncpci(52,'X2',8,'confLevel',confint);
disp([ num2str(100*confint) ' per cent confidence interval for the non centrality parameter'])
disp(ci)

99 per cent confidence interval for the non centrality parameter
47.9550   87.6262



### ncpci with option prec.

Increase the precision.

    prec=1e-12;
ci=ncpci(52,'X2',8,'prec',prec);
disp(['95 per cent confidence interval for the non centrality parameter'])
disp(ci)

95 per cent confidence interval for the non centrality parameter
43.5345   76.2003



### ncpci with option doAnimate.

set doAnimate to true.

    doAnimate=true;
ci=ncpci(52,'X2',8,'doAnimate',true);


### Confidence interval based on the F distibution.

See the animation which leads to convergence.

    ci=ncpci(52,'F',[8 3],'doAnimate',true);


## Input Arguments

### x — Non centrality parameter for which confidence interval is needed. Scalar double.

This is typically a value from $\chi^2$, $F$ or $t$ distribution. Confidence interval based on the noncentrality parameter of a noncentral distribution describes the degree of deviation from the null hypothesis. Its value is zero if the null hypothesis is true, and different from zero otherwise. For further details see the "More about" section of this document.

Data Types: single| double

### fType — distribution to use. Character.

Character equal to 'X2', 'F' or 't' which specifies the reference distribution to use. X2 means $\chi^2$ distribution, $F$ means Fisher F distribution and t means Student $t$ distribution.

Data Types: single| double

### df — degrees of freedom. Scalar or vector of length 2.

Degrees of freedom of the reference distribution. It fType is 'X2' or 't' df must be a scalar. If, on the other hand, fType is 'F', then df must be a vector of length 2 (which contains respectively the degrees of freedom of the numerator and of the denominator of the F distribution)

Data Types: single| double

### Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as  Name1,Value1,...,NameN,ValueN.

Example:  'confLevel',0.99 , 'prec',1e-05 , 'doAnimate',false 

### confLevel —confidence levels to be used to compute confidence intervals.scalar.

The default value of conflev is 0.95 that is 95 per cent confidence interval is computed.

Example:  'confLevel',0.99 

Data Types: double

### prec —tolerance for the iterative loop.scalar.

Iteration will run until the estimated percentile is <=prec away from the requested percentile.

The default value is 1e-6;

Example:  'prec',1e-05 

Data Types: single | double

### doAnimate —show graphically the iteration process.logical.

If doAnimate is true the the iteration process will be graphically displayed in a figure window. The default value of doAnimate is false.

Example:  'doAnimate',false 

Data Types: logical

## Output Arguments

### ci —confidence interval for the non centrality parameter.  1-by-2 vector

Vector which contains the lower and upper confidence interval of the non centrality parameter.

This function is used in the FSDA toolbox in function corrNominal to find the confidence interval of Cramer's $V$ index. This index is a function of the non centrality parameter associated with the $\chi^2$ index. Confidence intervals based on non central distributions depend on the "inversion confidence interval principle" (Stiegler and Fouladi 1997, pp. 237-239). The main idea is to use the observed value of a test statistic (that is input x in the language of this routine) to initiate a search for the lower and upper limits of to a $1-\alpha$ confidence interval for the non centrality parameter (the lower and upper bound of the confidence interval is given in output argument ci).

The confidence interval of the non centrality parameter can then be converted into a confidence interval of an index which takes into account the sample size (which for example can be the Cramer's $V$ index) as long as the effect-size index (parameter) is a monotonic function of the non centrality parameter.

See Smithson (2003) and "Measures of Effect Size" Toolbox for further details.

## References

Hentschke and Stüttgen (2011), European Journal of Neuroscience, 34, pp. 1887-1894.

Smithson, M.J. (2003), Confidence Intervals, Quantitative Applications in the Social Sciences Series, No. 140. Thousand Oaks, CA: Sage. pp. 39-41.

Hentschke H. and Stüttgen M. (2015), Measures of Effect Size Toolbox Version 1.4. Code by Harald Hentschke (University of Tübingen) and Maik Stüttgen (University of Bochum).

Steiger, J. H., & Fouladi, R. T. (1997), Noncentrality interval estimation and the evaluation of statistical models. In L. L. Harlow, S.,

A. Mulaik, & J.H. Steiger (Eds.), What if there were no significance tests? pp. 221-257. Mahwah, NJ: Lawrence Erlbaum.

## Acknowledgements

This function has been taken and adapted from the MATLAB toolbox 'Measures of effect Size' by Harald Hentschke and Maik C. Stüttgen.