Learn R Programming

setweaver (version 1.0.0)

cprob: cprob

Description

Computes the conditional probability \(P(Y=1 \mid X=1)\) for two binary vectors `y` and `x`. Rows with missing values in either vector are excluded.

Usage

cprob(y, x)

Value

A numeric scalar giving the conditional probability that `y = 1` given `x = 1`.

Arguments

y

A binary outcome vector (0/1 or logical). Must be the same length as `x`.

x

A binary predictor vector (0/1 or logical). Must be the same length as `y`.

Examples

Run this code
cprob(misimdata$y,misimdata$x1)

Run the code above in your browser using DataLab