Learn R Programming

MetricsWeighted (version 0.5.4)

r_squared_bernoulli: Pseudo R-Squared regarding Bernoulli deviance

Description

Wrapper to r_squared with deviance_function = deviance_bernoulli.

Usage

r_squared_bernoulli(actual, predicted, w = NULL, reference_mean = NULL, ...)

Value

A numeric vector of length one.

Arguments

actual

Observed values.

predicted

Predicted values.

w

Optional case weights.

reference_mean

An optional reference mean used to derive the null deviance. Recommended in out-of-sample applications.

...

Further arguments passed to r_squared.

Details

The deviance gain is calculated regarding the null model derived from the actual values. While fine for in-sample considerations, this is only an approximation for out-of-sample considerations. There, it is recommended to calculate null deviance regarding the in-sample (weighted) mean. This value can be passed by the argument reference_mean.

See Also

r_squared.

Examples

Run this code
r_squared(c(0, 0, 1, 1), c(0.1, 0.1, 0.9, 0.8), w = 1:4,
  deviance_function = deviance_bernoulli)
r_squared_bernoulli(c(0, 0, 1, 1), c(0.1, 0.1, 0.9, 0.8), w = 1:4)

Run the code above in your browser using DataLab