simpsonCor: Detect simpsons paradox in multilevel data

Description Usage Arguments Details Value See Also

Description

Allows visual inspection of multilevel data and the relations between a set of variables and one outcome variable, both on level 1 and on level 2.

Usage

1
simpsonCor(data, outcome, scales, cluster, ...)

Arguments

data

The data frame to be used.

outcome

The dependend variable, i. e. a variable to be used as a criterion in multilevel analysis.

scales

The set of variables which are all correlated with outcome (and not amongst each other).

cluster

The level 2 cluster variable, in which both the var1 and var2 are nested.

...

Other arguments passed on to cor.

Details

The function computes all correlations between a set of variables and one outcome variable on level-1 (within cluster) and level-2 (between cluster, i. e. between the cluster means). The correlations on different levels are then plotted against each other. The more a point is off the diagonal, the more the correlations differ on level 1 and level 2.

Value

A plot showing level 1 and level 2 correlations plotted against each other.

See Also

cor for the function that computes the correlation.


kthorstmann/horst documentation built on May 20, 2019, 7:04 p.m.