Calculates various coefficients for the Configural Frequencies Analysis (CFA) defining main- and (optional) 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 formula definition given in argument form
.
CFA(
patternfreq,
alpha = 0.05,
form = NULL,
ccor = FALSE,
family = poisson(),
intercept = FALSE,
method = "log",
blank = NULL,
cova = NULL,
bintest = TRUE,
...
)
an object of class CFA
with results.
an object of class "Pfreq"
, which is data in pattern frequencies representation - see function dat2fre
.
a numeric giving the alpha level for testing (default set to alpha=.05
)
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 referring 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
must be of class "matrix"
and must logical match to the argument patternfreq
, which is currently not checked! - but simply assumed.
either a logical (TRUE / FALSE) determining whether to apply a continuity correction or not for the Binomial Approximation to the z-Test. 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
.
argument passed to glm.fit
with default set to FALSE
character 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 contingency table. Only main effects models are possible in this case and thus the arguments form
, family
cova
and intercept
are ignored.
can be used to indicate which pattern (configurations) are declared as structural cells (configurations) for functional CFA. Should be either (1) a 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 (row) positions of the pattern in an 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.
a matrix (possibly with one or more columns) holding the covariate (mean) values for each pattern (configurations) see function dat2cov
.
a logical with default set to bintest=TRUE
; if set to bintest=FALSE
no calculations for the exact binomial test are performed, which can reduce processing time in some cases dramatically.
additional parameters passed through to other functions.
This is the main function of the package. It internal calls several functions of the package confreq-package
which are also available as single functions. For classification of the observed patterns into 'Types' and 'Antitypes' according to Lienert (1971), a S3 summary method for the resulting object of class "CFA"
can be applied - see summary.CFA
. An S3 plot method is useful for visualization of the contingency table and the 'Types' and 'Antitypes' -- see plot.CFA
. Since version 1.6.0-1 of confreq
survey weights are supported when tabluating a data set with function dat2fre
. In case that for the resulting tabulated data in the object of class c("data.frame","Pfreq")
survey weights were used the function CFA
will take into account those weigts for estimation of the expected counts -- currently only when method="log"
.
Lienert, G. A. (1971). Die Konfigurationsfrequenzanalyse: I. Ein neuer Weg zu Typen und Syndromen. Zeitschrift für Klinische Psychologie und Psychotherapie, 19(2), 99-115.
Glück, J., & Von Eye, A. (2000). Including covariates in Configural Frequency Analysis. Psychologische Beitrage, 42, 405–417.
Victor, N. (1989). An Alternativ Approach to Configural Frequency Analysis. Methodika, 3, 61–73.
Stemmler, M. (2020). Person-Centered Methods. Cham: Springer International Publishing.
#######################################
######### 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)
Run the code above in your browser using DataLab