bcnsm_fit: BCNSM Fit for Multivariate Positive Data

View source: R/05b_mle.R

bcnsm_fitR Documentation

BCNSM Fit for Multivariate Positive Data

Description

Fit a multivariate Box-Cox symmetric distribution generated by an NSM copula via maximum likelihood.

Usage

bcnsm_fit(
  y,
  association = c("unstructured", "uniform", "nonassociative"),
  copula = c("gaussian", "t", "slash", "hyp"),
  delta = NULL,
  margins = "bcno",
  control = control_fit(...),
  ...
)

Arguments

y

a matrix with the sample observations.

association

one of "unstructured" (default), "uniform", or "nonassociative", which specify the association matrix of the model.

copula

character; informs which normal scale mixture distribution should be used to generate the NSM copula. Currently, the copulas available are: Gaussian ("gaussian"), Student's t ("t"), slash ("slash"), and hyperbolic ("hyp").

delta

possible extra parameter associated with the mixing distribution of the copula. For example, the degrees of freedom of the t copula, or the heavy tailness parameter of the slash or the hyperbolic copula. To estimate the value of delta via profile log-likelihood, use the function choose_copula.

margins

a character or a character vector; specifies the marginal BCS distributions. If all BCS margins are the same, it is sufficient to enter only one character. A table with the current available BCS distributions can be seen in bcs.

control

a list of control arguments specified via control_fit.

...

further arguments passed to control_fit.

Value

The bcnsm_fit returns an object of class "bcnsm", which consists of a list with the following components:

mu, sigma, lambda, nu

vectors with the estimated values for mu, sigma, lambda, and nu, respectively.

gamma

the estimated parameters of the association matrix, if any.

margins

a character vector with the marginal BCS distributions of the fit.

association

structure of the association matrix. It can be one of "non-associative", "unstructured", or "uniform".

copula, delta

"copula" is a character which informs which normal scale mixture distribution was used to generate the NSM copula and "delta" is the possible extra parameter associated with the copula.

logLik

log-likelihood of the fitted model.

vcov

asymptotic covariance matrix of the maximum likelihood estimator of the model parameters vector. Specifically, the inverse of the observed information matrix, obtained via numeric Hessian matrix.

y

the response matrix.

optim_params

control optimization parameters used by control_fit.

nobs,d

the number of observations in the sample and the dimension of the response variable, respectively.

call

the function call.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@live.com>

References

Vanegas, L. H., and Paula, G. A. (2016). Log-symmetric distributions: statistical properties and parameter estimation. Brazilian Journal of Probability and Statistics, 30, 196-220.

Ferrari, S. L. P., and Fumes, G. (2017). Box-Cox symmetric distributions and applications to nutritional data. AStA Advances in Statistical Analysis, 101, 321-344.

Medeiros, R. M. R. de, and Ferrari, S. L. P. (2023). Multivariate Box-Cox symmetric distributions generated by a normal scale mixture copula.

Examples

## Not run: 
## Random sampling

### Sample size and dimension
n <- 200
d <- 4

### Association matrix
Gamma <- matrix(0.8, d, d)
diag(Gamma) <- 1

### Marginal specifications

margins <- c("bcno", "lt", "bct", "lno")

mu <- c(19, 20, 15, 20)
sigma <- c(0.2, 0.3, 0.4, 0.3)
lambda <- c(-1, NA, 1.6, NA)
nu <- c(NA, 4, 8, NA)

### Copula
copula <- "t"
delta <- 4

### Observations
set.seed(123) # Seed for reproducibility
y <- rbcnsm(n, mu, sigma, lambda, nu, Gamma, copula, delta, margins)
colnames(y) <- c("y1", "y2", "y3", "y4")

### Visualization (based on graphics::pairs functions)
mvplot(y)

## Fit with Gaussian copula and uniform structure
fit <- bcnsm_fit(y, association = "uniform", copula = "gaussian",
                 margins = c("bcno", "lt", "bct", "lno"))

class(fit)
methods(class = "bcnsm")

# Fit summaries
fit
summary(fit)

# Fit visualization

## Bivariate fit
plot(fit)

## Marginal fit
plot(fit, type = "margins")

## Transformed vectors
plot(fit, "epsilon")

# Choose the value of the extra parameter of the t copula (it can be slow)
fit_t <- choose_copula(fit, grid = 1:8, copula = "t")

## Final fit
final_fit <- fit_t[[4]]

final_fit
plot(final_fit)
plot(final_fit, type = "margins")

## End(Not run)

rdmatheus/BCNSM documentation built on Feb. 8, 2024, 1:28 a.m.