Last data update: 2014.03.03

R: Configural Frequencies Analysis Main Function
CFAR Documentation

Configural Frequencies Analysis Main Function

Description

Calculates various coefficients for the Configural Frequencies Analysis (CFA) defining main- and (optionaly) interaction effects. The core principle is to use glm in package stats to calculate the expected counts considering a designmatrix, which is constructed based on an formular definition given in argument form.

Usage

CFA(patternfreq, alpha = 0.05, form = NULL, ccor = FALSE,
  family = poisson(), intercept = FALSE, method = "log", blank = NULL,
  ...)

Arguments

patternfreq

an object of class "Pfreq", which is data in pattern frequencies representation - see function dat2fre.

alpha

a numeric giving the alpha level for testing (default set to alpha=.05)

form

either a character expression which can be coerced into a model formula with the function as.formula in the package stats. If this argument is left empty (at default form=NULL) the (internal) function design_cfg_cfa() will return a designmatrix coding only main effects and no interactions – for a designmatrix refering to three variables (V1, V2, V3) for example, leaving the argument form empty will be equivalent to assigning the character "~ V1 + V2 + V3" to the argument (form="~ V1 + V2 + V3"). A special Case is to define a null-model or rather a cfa model of order zero. In such a model no (main) effects are considered. This can be achieved bei passing the character expression "null" to the argument form – so: form = "null" – not to be confound with the default setting of this argument form=NULL. Another option is to define your own designmatrix and assign it to this argument (form) in this case the object assigned to form musst be of class "matrix" and must logicaly match to the argument patternfreq, which is currently not checked! - but simply assumed.

ccor

either a logical (TRUE / FALSE) determining wether to apply a continuity correction or not. When set to ccor=TRUE continuity correction is applied for expected values 5 =< expected =< 10. For ccor=FALSE no continuity correction is applied. Another option is to set ccor=c(x,y) where x is the lower and y the upper bound for expected values where continuity correction is applied. So ccor=c(5,10) is equivalent to ccor=TRUE.

family

argument passed to glm.fit with default set to poisson()

intercept

argument passed to glm.fit with default set to FALSE

method

charcter defining the estimation method for expected frequencies with default set to method="log" to estimate the expected frequencies using glm. An other option is to set this argument to method="margins" which will result in expected frequencies calculated based on the margins of the multidimensional contigency table. Only main effects models are posible in this case and thus the arguments form, family and intercept are ignored.

blank

unsed only if argument method is set to method="margins" otherwise ignored. Should be either (1) character vector defining the pattern (with spaces between variable categories), which will be ignored for calculation of expected frequencies; or (2) a numeric vector defining the position(s) of the pattern in object of class "Pfreq" (see. argument patternfreq), which will be ignored for calculation of expected frequencies. At default (blank=NULL) all possible pattern, as listed in object of class "Pfreq", are included for calculation of expected frequencies.

...

additional parameters passed through to other functions.

Details

This is the main function of the package. It internaly calls several functions of the package confreq which are also available as single functions. For clasification of the observed patterns into 'Types' and 'Antitypes' according to Linert (1971), a S3 summary method for the resulting object of class "CFA" can be applied - see summary.CFA.

Value

an object of class CFA with results.

References

Lienert, G. A. (1971). Die Konfigurationsfrequenzanalyse: I. Ein neuer Weg zu Typen und Syndromen. Zeitschrift f<c3><83><c2><bc>r Klinische Psychologie und Psychotherapie, 19(2), 99-115.

Examples

#######################################
######### some examples ########
data(LienertLSD)
LienertLSD
res1 <- CFA(LienertLSD)
summary(res1)
## testing with (full) interactions
res2 <- CFA(LienertLSD,form="~ C + T + A + C:T + C:A + T:A + C:T:A")
summary(res2)
#' ## testing the null model
res3 <- CFA(LienertLSD,form="null")
summary(res3)
#######################
data(suicide)
suicide
# suicide data is in non tabulated data representation - so it must be tabulated !
res4 <- CFA(dat2fre(suicide))  
summary(res4)

Results