Documentation

### This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

# merge

Merge estimated models

## Syntax

```m = merge(m1,m2,....,mN) [m,tv] = merge(m1,m2) ```

## Description

`m = merge(m1,m2,....,mN)` merges estimated models. The models `m1,m2,...,mN` must all be of the same structure, just differing in parameter values and covariance matrices. Then `m` is the merged model, where the parameter vector is a statistically weighted mean (using the covariance matrices to determine the weights) of the parameters of `mk`.

`[m,tv] = merge(m1,m2)` returns a test variable `tv`. When two models are merged,

```[m, tv] = merge(m1,m2) ```

`tv` is χ2 distributed with `n` degrees of freedom, if the parameters of `m1` and `m2` have the same means. Here `n` is the length of the parameter vector. A large value of `tv` thus indicates that it might be questionable to merge the models.

For `idfrd` models, `merge` is a statistical average of two responses in the individual models, weighted using inverse variances. You can only merge two `idfrd` models with responses at the same frequencies and nonzero covariances.

Merging models is an alternative to merging data sets and estimating a model for the merged data.

```load iddata1 z1; load iddata2 z2; m1 = arx(z1,[2 3 4]); m2 = arx(z2,[2 3 4]); ma = merge(m1,m2); ```

and

```mb = arx(merge(z1,z2),[2 3 4]); ```

result in models `ma` and `mb` that are related and should be close. The difference is that merging the data sets assumes that the signal-to-noise ratios are about the same in the two experiments. Merging the models allows one model to be much more uncertain, for example, due to more disturbances in that experiment. If the conditions are about the same, we recommend that you merge data rather than models, since this is more efficient and typically involves better conditioned calculations. 