# Mvdc

##### Multivariate Distributions Constructed from Copulas

Density, distribution function, and random generator for a
multivariate distribution via copula and *parametric* margins.

For likelihood and fitting these distributions to data, see
`fitMvdc`

.

- Keywords
- multivariate, distribution

##### Usage

```
mvdc(copula, margins, paramMargins, marginsIdentical = FALSE,
check = TRUE, fixupNames = TRUE)
dMvdc(x, mvdc, log=FALSE)
pMvdc(x, mvdc)
rMvdc(n, mvdc)
```

##### Arguments

- copula
- margins
a

`character`

vector specifying all the parametric marginal distributions. See details below.- paramMargins
a

`list`

whose each component is a list (or numeric vectors) of named components, giving the parameter values of the marginal distributions. See details below.- marginsIdentical
logical variable restricting the marginal distributions to be identical.

- check
logical indicating to apply quick checks about existence of

`margins`

“p*” and “d*” functions.- fixupNames
logical indicating if the parameters of the margins should get automatic names (from

`formals(p<mar_i>)`

).- mvdc
- x
a numeric vector of length the copula dimension, say \(d\), or a matrix with the number of columns being \(d\), giving the coordinates of the points where the density or distribution function needs to be evaluated.

- log
logical indicating if the

`log`

density should be returned.- n
number of observations to be generated.

##### Details

The characters in argument `margins`

are used to construct
density, distribution, and quantile function names. For
example, `norm`

can be used to specify marginal distribution,
because `dnorm`

, `pnorm`

, and `qnorm`

are all
available.

A user-defined distribution, for example, `fancy`

, can be used as
margin * provided* that

`dfancy`

, `pfancy`

, and
`qfancy`

are available.Each component list in argument `paramMargins`

is a
`list`

with named components which are used to specify the
parameters of the marginal distributions. For example, the list

paramMargins = list(list(mean = 0, sd = 2), list(rate = 2))

can be used to specify that the first margin is normal with mean 0 and standard deviation 2, and the second margin is exponential with rate 2.

##### Value

`mvdc()`

constructs an object of class `"'>mvdc"`

.
`dMvdc()`

gives the density, `pMvdc()`

gives the cumulative
distribution function, and `rMvdc()`

generates random variates.

##### Note

`mvdc()`

, `fitMvdc`

, etc, are only for
*parametric* margins.
If you do not want to model all margins parametrically, use the
standard copula approach, transforming the data by their
empirical margins via `pobs`

and modelling the copula
alone, e.g., using `fitCopula`

, i.e., conceptually,
using

fitCopula(.., pobs(x))

##### See Also

`ellipCopula`

,
`archmCopula`

;
the classes `'>mvdc`

and `'>copula`

.

##### Examples

```
# NOT RUN {
## construct a bivariate distribution whose marginals
## are normal and exponential respectively, coupled
## together via a normal copula
mv.NE <- mvdc(normalCopula(0.75), c("norm", "exp"),
list(list(mean = 0, sd =2), list(rate = 2)))
dim(mv.NE)
mv.NE # using its print() / show() method
persp (mv.NE, dMvdc, xlim = c(-4, 4), ylim=c(0, 2), main = "dMvdc(mv.NE)")
persp (mv.NE, pMvdc, xlim = c(-4, 4), ylim=c(0, 2), main = "pMvdc(mv.NE)")
contour(mv.NE, dMvdc, xlim = c(-4, 4), ylim=c(0, 2))
# }
# NOT RUN {
# Generate (bivariate) random numbers from that, and visualize
x.samp <- rMvdc(250, mv.NE)
plot(x.samp)
summary(fx <- dMvdc(x.samp, mv.NE))
summary(Fx <- pMvdc(x.samp, mv.NE))
op <- par(mfcol=c(1,2))
pp <- persp(mv.NE, pMvdc, xlim = c(-5,5), ylim=c(0,2),
main = "pMvdc(mv.NE)", ticktype="detail")
# }
# NOT RUN {
<!-- %% FIXME: provide "empiricalCopula" .. with persp() method, see ../TODO !! -->
# }
# NOT RUN {
px <- copula:::perspMvdc(x.samp, FUN = F.n, xlim = c(-5, 5), ylim = c(0, 2),
main = "F.n(x.samp)", ticktype="detail")
par(op)
all.equal(px, pp)# about 5% difference
# }
```

*Documentation reproduced from package copula, version 0.999-19, License:*