% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/PortfolioMeanimile.R
\name{PortfolioMeanimile}
\alias{PortfolioMeanimile}
\title{Estimate portfolio meanimile}
\usage{
PortfolioMeanimile(
  data,
  weights,
  d_tau,
  tau,
  lossDerivative,
  delta = NULL,
  copula_obj = NULL,
  margin_dists = NULL,
  N = 1e+05,
  grid_size = 1000
)
}
\arguments{
\item{data}{A numeric matrix or data.frame (n observations x d assets).}

\item{weights}{A numeric vector of portfolio weights summing to 1.}

\item{d_tau}{A function representing the density function of the
distributional weight function D_tau.}

\item{tau}{A numeric risk level/index (e.g., 0.95).
Argument of d_tau function.}

\item{lossDerivative}{Function defining the derivative of the loss function.}

\item{delta}{Optional numeric parameter for the loss function (default:NULL).}

\item{copula_obj}{An unfitted 'copula' object (e.g., \code{copula::gumbelCopula(dim=3)}).
If \code{NULL}, an Empirical Beta Copula is used.}

\item{margin_dists}{A character vector of base R distribution root names for \code{fitdistrplus::fitdist}
(e.g., \code{c("norm", "exp", "weibull")}). If \code{NULL}, empirical margins are used.}

\item{N}{Integer. Number of Monte Carlo simulations to draw (default: 100 000).}

\item{grid_size}{An integer defining the resolution of the fallback grid (default: 1000).}
}
\value{
A numeric scalar representing the estimated meanimile.
}
\description{
Estimates the risk of an aggregated portfolio using the
meanimile framework. Supports parametric and nonparametric modeling
of marginal distributions and copula.
}
\examples{

gumbel.cop <- copula::gumbelCopula(10 / 9, dim = 3)
myMvdX <- copula::mvdc(
  copula = gumbel.cop, margins = c("norm", "norm", "exp"),
  paramMargins = list(
    list(mean = 0, sd = 1),
    list(mean = 0, sd = 1),
    list(rate = 1)
  )
)
X <- copula::rMvdc(500, myMvdX)

d_tau_expectile <- function(u, tau) {
  1
}
lossDerivativeExpectiles <- function(x, c, delta) {
  -2 * ifelse(x > c, delta, 1 - delta) * (x - c)
}
gumbelCopula <- copula::gumbelCopula(dim = 3)
margin_dists <- c("norm", "norm", "exp")
weights <- c(1 / 3, 1 / 3, 1 / 3)
PortfolioMeanimile(
  data = X, weights, d_tau_expectile, tau = 0, lossDerivativeExpectiles, delta = 0.95,
  copula_obj = gumbelCopula, margin_dists = margin_dists, N = 100000, grid_size = 1000
)

}
\references{
D. Debrauwer and I. Gijbels (2026)
Copula-based estimation of meanimiles of aggregated risks.
Metrika
doi:https://doi.org/10.1007/s00184-026-01022-9
}
