# Compute marginals using Bayesian Model Averaging

### Description

`fitmargBMA`

takes a list of marginal distributions and weights
(presumably, based on some marginal likelihoods) and computes a
final distribution by weighting.

`fitmargBMA2`

takes a list of INLA models and computes Bayesian
Model Averaging on some of their components.

`fitmatrixBMA`

performs averaging on a list of matrices.

`fitlistBMA`

performs averaging of elements in lists.

### Usage

1 2 3 4 | ```
fitmargBMA(margs, ws, len = 100)
fitmargBMA2(models, ws, item)
fitmatrixBMA(models, ws, item)
fitlistBMA(models, ws, item)
``` |

### Arguments

`margs` |
List of 2-column matrices with the values of the (marginal) distributions. |

`models` |
List of INLA models to be averaged. |

`ws` |
Vector of weights. They do not need to sum up to one. |

`len` |
Length of the x-vector to compute the weighted distribution. |

`item` |
Name of the elements of an INLA object to be used in the Model Averaging. |

### Details

For `fitmargBMA`

, distributions provided are averaging according to the
weights provided. A new probability distribution is obtained.

`fitmargBMA2`

uses a list of INLA models to compute Model Averaging
on some of their components (for example, the fitted values).

`fitmatrixBMA`

performs averaging on a list of matrices.

`fitlistBMA`

performs averaging of a list of a list of matrices.

### Value

`fitmargBMA`

returns a 2-column matrix with the weighted marginal
distribution.

`fitmargBMA2`

returns a list of weighted components.

`fitmatrixBMA`

returns a matrix.

`fitlistBMA`

returns a list.

### Author(s)

Virgilio G<f3>mez-Rubio <virgilio.gomez@uclm.es>