stirling_cfa: Approximation to the binomial using Stirling's Formula

View source: R/stirling_cfa.r

stirling_cfaR Documentation

Approximation to the binomial using Stirling's Formula

Description

Calculates the binomial aproximation using stirling's formula (Version of function: V 1.0 - November 2013)

Usage

stirling_cfa(
  observed,
  expected = NULL,
  n = sum(observed),
  p = NULL,
  cum = T,
  verb = T
)

Arguments

observed

a integer vector with observed freqencies

expected

a vector giving the expected frequencies. expected can be set to expected=NULL if an vector of cell probabilities is given in argument p.

n

number of trials (scalar) default is n = sum(observed) .

p

a vector of cell probabilities. If p is not NULL the argument expected is ignored and this vector p of cell probabilities is used for calculatio instead of expected counts

cum

a logical - computation of cumulative density. If cum=TRUE (default) computes tail probability. If cum=FALSE computes prob. only for one cell (i.e. execute stircore only).

verb

logical - verbose results: If verb=TRUE (default) builds a results table. If verb=FALSE returns vector of cell p-values only.

Details

  • Vector p must be of same length as observed _or_ p may be a scalar (e.g. in case of the zero-order CFA).

  • The routine autoselects the upper or lower tail:

    • if obs > exp then sum obs:n

    • else sum 0:obs

  • The stirling approximation cannot be evaluated if the observed frequency is 0 or n. Therefore, the proposal of A. von Eye (20xx) is adopted, taking the sum up to 1 or n-1, respectively.

Author(s)

R.W. Alexandrowicz

References

von Eye, A. (2002). Configural Frequency Analysis. Methods, Models, and Applications. Mahwah, NJ, LEA.


confreq documentation built on Nov. 13, 2022, 9:05 a.m.