% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sim.R
\name{tune.and.aggregate}
\alias{tune.and.aggregate}
\title{Tuning and aggregation function for sim object.}
\usage{
tune.and.aggregate(obj, z, tune = TRUE)
}
\arguments{
\item{obj}{The sim object.}

\item{z}{The metric to be tuned. Should be a list of lengh N, where N is the
number of methods under consideration in the simulation, and in the ith
element of the list should be a matrix of dimension nrep x m, where nrep is
the number of repetitions in the simulation, and m is the number of tuning
parameters for the ith method.}

\item{tune}{Either TRUE or FALSE, indicating whether the metric should be
tuned; if FALSE, then it is only aggregated (for each value of the tuning
parameter). Default is TRUE.}
}
\value{
A list with components z.ave, z.std, z.med, z.mad, z.val, z.ora,
  z.val.ave, z.val.std, z.val.med, z.val.mad, z.ora.ave, z.ora.std,
  z.ora.med, z.ora.mad.  The elements z.ave, z.std, z.med, z.mad are lists of
  length N, where N is the number of methods in the simulation; in the ith
  element of z.ave is a vector of length m, the number of tuning parameters
  for the ith method, giving the averages of the metric across the
  repetitions for each tuning parameter value; similarly z.std contains
  standard errors, z.med contains medians, and z.mad contains median absolute
  deviations.  The elements z.val, z.ora are matrices of dimension nrep x N,
  where nrep is the number of repetitions, whose rows contain the metric
  after it has been tuned on each repetition by selecting the tuning
  parameter for each method in one of two ways: validation tuning, where the
  tuning parameter is selected to minimize prediction error on the validation
  set, and oracle tuning, where the tuning parameter is selected to minimize
  average test error. The elements named z.val.xxx, where xxx is one of ave,
  std, med, or mad, are each vectors of length N, containing the average of
  the metric for each method under validation tuning; similarly for the
  postfixes std, med, and mad; and for the elements named z.ora.xxx.
}
\description{
Tune and aggregate a given metric across a set of simulations, stored in a
  sim object (produced by \code{\link{sim.master}}).
}

