cfa2 {cfa2}R Documentation

Analysis of configuration frequencies using a design matrix

Description

DESCRIPTION

Usage

	cfa2(cfg, conf_cols = NA, cnts = NA, sorton = "chisq", sort.descending = FALSE, 
	    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.

conf_cols

DESCRIBE

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

The warnings written in the help file for the cfa function apply! Please take a close look at them.

Author(s)

Felix Schönbrodt

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

cfa, scfa

Examples

	# First order CFA of the Lienert-LSD data
	# Variables A, B and C
	# ofreq = observed frequencies
	ofreq <- c(20,1,4,12,3,10,15,0)

	# Type in the configurations in CFA Format
	config <- matrix(c(1,1,1,1,1,2,1,2,1,1,2,2,2,1,1,2,1,2,2,2,1,2,2,2), ncol=3, byrow=TRUE)

	# use configuration patterns as input; original R-package 'cfa' 
	mode<-cfa(config, ofreq, exact.binom.test=TRUE, sorton="label", alpha=0.05)
	mode

	# R-package 'cfa2'; here design matrix with three main effects A, B and C
	X <- matrix(c(1,1,1,1,1,1,1,1, 1,1,1,1,-1,-1,-1,-1, 1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1, -1), ncol=4) 
	mode_ <- cfa2(X, conf_cols=2:4, ofreq, binom.test=TRUE, sorton="label", alpha=0.05)
	mode_

	# design matrix with saturated model
	X <- matrix(c(1,1,1,1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,1,-1),ncol=8) 
	mode8 <- cfa2(X, conf_cols=2:4, ofreq, binom.test=TRUE, sorton="label", alpha=0.05)
	mode8

	# design matrix with three main effects and two  interactions A x B, A x C
	X <- matrix(c(1,1,1,1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,1), ncol=6) 
	mode7 <- cfa2(X, conf_cols=2:4, ofreq, binom.test=TRUE, sorton="label", alpha=0.05)
	mode7

	# design matrix with null model or CCA
	X <- matrix(c(1,1,1,1,1,1,1,1), ncol=1)
	mode5 <- cfa2(X, conf_cols=2:4, ofreq, binom.test=TRUE, exact.binom.test = TRUE, exact.binom.limit = 21, sorton="label", sort.descending=TRUE, alpha=0.05)
	mode5

	# another example from the book: two main effects A, B
	X1 <- matrix(c(1,1,1,1,-1,-1, 1, 1, -1, 1,-1,1), ncol=3)
	ofreq1 <- c(5, 37, 8, 6)
	mode6 <- cfa2(X1, conf_cols=2:3, ofreq1, binom.test=TRUE, sorton="label", sort.descending=TRUE, alpha=0.05)
	mode6


	#  Exercise (PartII): four variables D,I,R,V
	X2 <- matrix(c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,-1, 1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1, 1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1, 1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1 ), ncol=5)
	ofreq2 <- c(15,30,9,32,23,22,14,16,25,22,46,27,14,8,47,12)
	mode66 <- cfa2(X2, conf_cols=2:5, ofreq2, binom.test=TRUE, sorton="label", sort.descending=TRUE, bonferroni=FALSE, alpha=0.05)
	mode66


[Package cfa2 version 0.1.2 Index]