  Given a sample from a multivariate distribution $F$, the uniform random
variates generated independently and rearranged in the order specified by the
componentwise ranks of the original sample look like a sample from the copula
of $F$. This idea can be regarded as a variant on Baker's [J. Multivariate
Anal. 99 (2008) 2312--2327] copula construction and leads to the definition of
the empirical beta copula. The latter turns out to be a particular case of the
empirical Bernstein copula, the degrees of all Bernstein polynomials being
equal to the sample size.
  Necessary and sufficient conditions are given for a Bernstein polynomial to
be a copula. These imply that the empirical beta copula is a genuine copula.
Furthermore, the empirical process based on the empirical Bernstein copula is
shown to be asymptotically the same as the ordinary empirical copula process
under assumptions which are significantly weaker than those given in Janssen,
Swanepoel and Veraverbeke [J. Stat. Plan. Infer. 142 (2012) 1189--1197].
  A Monte Carlo simulation study shows that the empirical beta copula
outperforms the empirical copula and the empirical checkerboard copula in terms
of both bias and variance. Compared with the empirical Bernstein copula with
the smoothing rate suggested by Janssen et al., its finite-sample performance
is still significantly better in several cases, especially in terms of bias.
