deviance_loss: Deviance loss function for multinomial regression

Description Usage Arguments Details Author(s) References See Also Examples

Description

Computing the deviance loss function for a multinomial regression estimate

Usage

1
deviance_loss(fit, validation, per_obs = F)

Arguments

fit

an object of class fast_multinom, fit on the training data.

validation

a validation dataset.

per_obs

logical. If per_obs==T, the loss is normalized by the total number of observations (sum of all counts), so it is the mean loss.

Details

The deviance loss function for categorical data is estimated as described for example in Hastie et al, p. 221.

Author(s)

Johanna Bertl

References

Bertl, J.; Guo, Q.; Rasmussen, M. J.; Besenbacher, S; Nielsen, M. M.; Hornshøj, H.; Pedersen, J. S. & Hobolth, A. A Site Specific Model And Analysis Of The Neutral Somatic Mutation Rate In Whole-Genome Cancer Data. bioRxiv, 2017. doi: https://doi.org/10.1101/122879 http://www.biorxiv.org/content/early/2017/06/21/122879

Hastie, T.; Tibshirani, R. & Friedman, J. The Elements of Statistical Learning Springer New York Inc., 2001

See Also

fast_multinom

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(cancermutations)

# the APOBEC signature is only relevant for transitions and transversions to a G:C basepair -- construct the corresponding subset of parameters for the 3 binomial models:
subs = matrix(T, ncol=3, nrow=4)
subs[3,2] = F

# fit the multinomial model on the first half of the data
split = nrow(cancermutations)/2
cancermutations_est = cancermutations[1:split,]
cancermutations_loss = cancermutations[(split+1):(split*2),]
fit = fast_multinom(cbind(NO, I, VA, VG) ~ strong + apobec + cancer_type, data = cancermutations_est, refLevel=1, VC=T, subsetmatrix=subs)

# estimation of the loss function on second half of the data:
deviance_loss(fit, cancermutations_loss)

MultinomialMutations/MultinomialMutations documentation built on May 22, 2019, 4:39 p.m.