% Generated by roxygen2 (4.1.1): do not edit by hand % Please edit documentation in R/distrib.R \name{lossdistrib2} \alias{lossdistrib2} \title{Loss distribution of a portfolio} \usage{ lossdistrib2(p, w, S, N, defaultflag = FALSE) } \arguments{ \item{p}{Numeric, vector of default probabilities} \item{w}{Numeric, vector of weights} \item{S}{Numeric, vector of severities} \item{N}{Integer, number of ticks in the grid} \item{defaultflag}{Boolean, if TRUE, we compute the default distribution (instead of the loss distribution).} } \value{ a Numeric vector of size \code{N} computing the loss (resp. default) distribution if \code{defaultflag} is FALSE (resp. TRUE). } \description{ \code{lossdistrib2} computes the probability distribution of a sum of independent Bernouilli variables with unequal probabilities. } \details{ We compute the probability distribution of \eqn{L = \sum_{i=1}^n w_i S_i X_i} where \eqn{X_i} is Bernouilli(\eqn{p_i}). If \code{defaultflag} is TRUE, we compute the distribution of \eqn{D = \sum_{i=1}^n w_i X_i} instead. This a recursive algorithm with first order correction for discretization. }