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

Description Usage Arguments Value Author(s) Examples

View source: R/devianceTweedie.R

Description

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

Usage

1
devianceTweedie(Y, Y_hat, p=1.5)

Arguments

Y

a numeric vector of observations.

Y_hat

a numeric vector of predictions for Y (must have same length as Y.)

p

Tweedie distribution variance power parameter

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 <- rgamma(n, shape=15, scale=10)
# observed <- rtweedie(n, true, phi=50, p=1.5)
# predicted <- exp(log(150)/3 + 2*log(true)/3 + rnorm(n, sd=0.1))
# 
# plot(observed, predicted)
# 
# devs <- devianceTweedie(observed, predicted)
# sum(devs)

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