Learn R Programming

dsld (version 0.2.2)

dsldConditDisparity: dsldConditDisparity

Description

Plots (estimated) mean Y against X, separately for each level of S, with restrictions condits. May reveal Simpson's Paradox-like differences not seen in merely plotting mean Y against X.

Usage

dsldConditDisparity(data, yName, sName, xName, condits = NULL,
    qeFtn = qeKNN, minS = 50, useLoess = TRUE)

Value

No value; plot.

Arguments

data

Data frame or equivalent.

yName

Name of predicted variable Y. Must be numeric or dichtomous R factor.

sName

Name of the sensitive variable S, an R factor

xName

Name of a numeric column for the X-axis.

condits

An R vector; each component is a character string for an R logical expression representing a desired condition involving names(data) other than S and Y.

qeFtn

qeML predictive function (not quoted; only default arguments will be used.)

minS

Minimum size for an S group to be retained in the analysis.

useLoess

If TRUE, do loess smoothing on the fitted regression values.

Author

N. Matloff, A. Ashok, S. Martha, A. Mittal

Examples

Run this code
# \donttest{
data(compas)
# graph probability of recidivism by race given age, among those with at
# most 4 prior convictions and COMPAS decile score at least 6
compas$two_year_recid <- as.numeric(compas$two_year_recid == "Yes")
dsldConditDisparity(compas,"two_year_recid", "race", "age", 
    c("priors_count <= 4","decile_score>=6"), qeKNN)

dsldConditDisparity(compas,"two_year_recid", "race", "age",
    "priors_count == 0", qeGBoost)
# }

Run the code above in your browser using DataLab