Learn R Programming

gdverse (version 1.3-1)

interaction_detector: interaction detector

Description

Identify the interaction between different risk factors, that is, assess whether factors X1 and X2 together increase or decrease the explanatory power of the dependent variable Y, or whether the effects of these factors on Y are independent of each other.

Usage

interaction_detector(y, x1, x2)

Value

A list.

Variable1 Q-statistics

Q-statistics for variable1

Variable2 Q-statistics

Q-statistics for variable2

Variable1 and Variable2 interact Q-statistics

Q-statistics for variable1 and variable2 interact

Interaction

the interact result type

Arguments

y

Dependent variable, continuous numeric vector.

x1

Covariate \(X_1\), factor, character or discrete numeric.

x2

Covariate \(X_2\), factor, character or discrete numeric.

Examples

Run this code
interaction_detector(y = 1:7,
                     x1 = c('x',rep('y',3),rep('z',3)),
                     x2 = c(rep('a',2),rep('b',2),rep('c',3)))

Run the code above in your browser using DataLab