devianceBernoulli: Function to calculate deviance for model predictions assuming...

Description Usage Arguments Value Author(s) Examples

View source: R/devianceBernoulli.R

Description

This function calculates a deviance measure for model predictions assuming a Bernoulli distribution.

Usage

1

Arguments

Y

a numeric vector of observations (0s and 1s.)

Y_hat

a numeric vector of predictions (between 0 and 1) for Y (must have same length as Y.)

Value

a numeric vector.

Author(s)

Edwin Graham <edwingraham1984@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# n <- 1000
# 
# true <- 1/(1+exp(-rnorm(n)))
# observed <- rbinom(n, 1, true)
# predicted <- 1/(1+exp(-(rnorm(n, sd=0.1) + log(true/(1-true))/2 )))
# 
# plot(observed, predicted)
# 
# devs <- devianceBernoulli(observed, predicted)
# sum(devs)

EdwinGraham/EdNet documentation built on May 6, 2019, 12:22 p.m.