Learn R Programming

CCI (version 0.3.6)

clean_formula: Clean and Reformat Formula String

Description

This function processes and reformats formula string to ensure it is in the correct format for conditional independence testing. The function checks if the formula uses the '+' operator for additive models and transforms it into a format that includes a conditioning variable separated by '|'.

Usage

clean_formula(formula)

Value

A reformatted formula in the correct format for conditional independence testing. The returned formula will either retain the original format or be transformed to include conditioning variables.

Arguments

formula

Formula. The model formula that specifies the relationship between the dependent and independent variables, and potentially the conditioning variables. The formula is expected to follow the format Y ~ X + Z1 + Z2 or Y ~ X | Z1 + Z2.

Examples

Run this code
clean_formula(y ~ x | z + v)
clean_formula(y ~ x + z + v)

Run the code above in your browser using DataLab