cfa: Analysis of configuration frequencies

Description Usage Arguments Details Value WARNING Note Author(s) References See Also Examples

View source: R/cfa.r

Description

This is the main function which will call scfa() und mcfa() as required to handle the simple and the multiple cfa.

Usage

1
2
3
4
5
cfa(cfg, cnts=NA, sorton="chisq", sort.descending=TRUE, format.labels=TRUE, 
    casewise.delete.empty=TRUE, 
    binom.test=FALSE, exact.binom.test=FALSE, exact.binom.limit=10, 
    perli.correct=FALSE, lehmacher=FALSE, lehmacher.corr=TRUE, 
    alpha=0.05, bonferroni=TRUE)

Arguments

cfg

Contains the configurations. This can be a dataframe or a matrix. The dataframe can contain numbers, characters, factors, or booleans. The matrix can consist of numbers, characters, or booleans (factors are implicitely re-converted to numerical levels). There must be >=3 columns.

cnts

Contains the counts for the configuration. If it is set to NA, a count of one is assumed for every row. This allows untabulated data to be processed. cnts can be a vector or a matrix/dataframe with >=2 columns.

sorton

Determines the sorting order of the output table. Can be set to chisq, n, or label.

sort.descending

Sort in descending order

format.labels

Format the labels of the configuration. This makes to output wider but it will increase the readability.

casewise.delete.empty

If set to TRUE all configurations containing a NA in any column will be deleted. Otherwise NA is handled as the string "NA" and will appear as a valid configuration.

binom.test

Use z approximation for binomial test.

exact.binom.test

Do an exact binomial test.

exact.binom.limit

Maximum n for which an exact binomial test is performed (n >10 causes p to become inexact).

perli.correct

Use Perli's correction for multiple test.

lehmacher

Use Lehmacher's correction for multiple test.

lehmacher.corr

Use a continuity correction for Lehmacher's correction.

alpha

Alpha level

bonferroni

Do Bonferroni adjustment for multiple test (irrelevant for Perli's and Lehmacher's test).

Details

The cfa is used to sift large tables of nominal data. Usually it is used for dichotomous variables but can be extended to three or more possible values. There should be at least three configuration variables in cfg - otherwise a simple contigency table would do. All tests of significance are two-sided: They test for both types or antitypes, i.e. if n is significantly larger or smaller than the expected value. The usual caveats for testing contigency tables apply. If a configuration has a n <5 an exact test should be used. As an alternative the least interesting configuration variable can be left out (if it is not essential) which will automatically increase the n for the remaining configurations.

Value

Some of these elements will only be returned when the corresponding argument in the function call has been set. The relation is obvious due to corresponding names.

table

The cfa output table

table["label"]

Label for the given configuration

table["n"]

Observed n for this configuration

table["expected"]

Expected n for this configuration

table["Q"]

Coefficient of pronouncedness (varies between 0 and 1)

table["chisq"]

Chi squared for the given configuration

table["p.chisq"]

p for the chi squared test

table["sig.chisq"]

Is it significant (will Bonferroni-adjust if argument bonferroni is set)

table["z"]

z-approximation for chi squared

table["p.z"]

p of z-test

table["sig.z"]

Is it significant (will Bonferroni-adjust if argument bonferroni is set)?

table["x.perli"]

Statistic for Perli's test

table["sig.perli"]

Is it significant (this is designed as a multiple test)?

table["zl"]

z for Lehmacher's test

table["sig.zl"]

Is it significant (this is designed as a multiple test)?

table["zl.corr"]

z for Lehmacher's test (with continuity correction)

table["sig.zl.corr"]

Is it significant (this is designed as a multiple test)?

table["p.exact.bin"]

p for exact binomial test

summary.stats

Summary stats for entire table

summary.stats["totalchisq"]

Total chi squared

summary.stats["df"]

Degrees of freedom

summary.stats["p"]

p for the chi squared test

summary.stats["sum of counts"]

Sum of all counts

levels

Levels for each configuration. Should all be 2 for the bivariate case

WARNING

Note than spurious "significant" configurations are likely to appear in very large tables. The results should therefore be replicated before they are accepted as real. boot.cfa can be helpful to check the results.

Note

There are no hard-coded limits in the program so even large tables can be processed. The output table can be very wide if the levels of factors variables are long strings so ‘options(width=..)’ may need to be adjusted.

The object returned has the class scfa if a one-sample CFA was performed or the class mcfa if a repeated-measures CFA was performed. cfa() decides which one is appropriate by looking at cnts: If it is a vector, it will do a simple CFA. If it is a dataframe or matrix with 2 or more columns, a repeated-measures CFA ist done.

Author(s)

Stefan Funke <[email protected]>

References

Krauth J., Lienert G. A. (1973, Reprint 1995) Die Konfigurationsfrequenzanalyse (KFA) und ihre Anwendung in Psychologie und Medizin. Beltz Psychologie Verlagsunion

Lautsch, E., von Weber S. (1995) Methoden und Anwendungen der Konfigurationsfrequenzanalyse in Psychologie und Medizin. Beltz Psychologie Verlagsunion

Eye, A. von (1990) Introduction to configural frequency analysis. The search for types and anti-types in cross-classification. Cambride 1990

See Also

scfa, mcfa

Examples

1
2
3
4
5
6
# library(cfa) if not yet loaded
# Some random configurations:
configs<-cbind(c("A","B")[rbinom(250,1,0.3)+1],c("C","D")[rbinom(250,1,0.1)+1],
          c("E","F")[rbinom(250,1,0.3)+1],c("G","H")[rbinom(250,1,0.1)+1])
counts<-trunc(runif(250)*10)
cfa(configs,counts) 

Example output

*** Analysis of configuration frequencies (CFA) ***

     label   n  expected            Q       chisq      p.chisq sig.chisq
1  A D E G  61  35.84296 0.0217028777 17.65693740 2.645486e-05      TRUE
2  A C E H  80  55.72089 0.0213109375 10.57906531 1.143755e-03      TRUE
3  B C F G 132 101.16078 0.0281935590  9.40144520 2.168145e-03      TRUE
4  B D F G   1   7.94313 0.0058490288  6.06902475 1.375729e-02     FALSE
5  A C F H  16  25.88017 0.0084509474  3.77191350 5.211998e-02     FALSE
6  B D E G  25  17.10183 0.0067053072  3.64762553 5.614921e-02     FALSE
7  B C E G 194 217.80263 0.0243580557  2.60127762 1.067776e-01     FALSE
8  A C E G 430 456.48271 0.0358592960  1.53638663 2.151565e-01     FALSE
9  B C F H   8  12.34826 0.0036767072  1.53117887 2.159356e-01     FALSE
10 A C F G 222 212.01832 0.0101544949  0.46993102 4.930189e-01     FALSE
11 B C E H  26  26.58624 0.0005017369  0.01292673 9.094790e-01     FALSE
           z          p.z sig.z
1   4.181691 1.446747e-05  TRUE
2   3.262536 5.520999e-04  TRUE
3   3.152866 8.083794e-04  TRUE
4  -2.649769 9.959727e-01  TRUE
5  -2.062887 9.804383e-01 FALSE
6   1.801910 3.577981e-02 FALSE
7  -1.821019 9.656980e-01 FALSE
8  -1.606486 9.459164e-01 FALSE
9  -1.386880 9.172608e-01 FALSE
10  0.717976 2.363860e-01 FALSE
11 -0.213050 5.843560e-01 FALSE


Summary statistics:

Total Chi squared         =  57.27771 
Total degrees of freedom  =  11 
p                         =  3.785861e-14 
Sum of counts             =  1195 

Levels:

V1 V2 V3 V4 
 2  2  2  2 

cfa documentation built on May 30, 2017, 4:59 a.m.