# Model types explained

We are aware that the list below is incomplete and possibly even out of date in some cases. The most up to date documentation can always be found (if not here) in the default.xml configuration file and, of course, in the source files.

Also see the Using a model and Add Model Type pages.

## Model (Abstract base class)

The Model class serves as an overal base class, it is the interface to which all models should adhere.

## RationalModel

A rational model tries to interpolate or approximate data by a rational function, like [itex]3 x^2 y + 5 x y + 2x + 1[/itex] or by a quotient of 2 polynomial, like [itex]\dfrac{xy + 2x + 6y + 2}{xy + 1}[/itex]

To decide which degrees (monomials) are present in numerator and denominator, the polynomial model depends on three model parameters:

• Variable weights W1 ... Wd (integer values, one for each dimension)
• Variable flags F1 ... Fd (boolean values, one for each dimension)
• An indicator for the degrees of freedom, P

To determine which degrees to use, this procedure is followed:

1. Determine the number of sample points N
2. Use P to determine the requested degrees of freedom: freedom = N * P / 100
3. Select degrees based on weighting and flags, using following rules:
• Only variables for which Fi == false (0) are allowed in the denominator
• Monomials with degrees (a1 ... ad) get precedence over monomials with degrees (b1 ... bd) if and only if the expression a1*W1 + ... + ad*Wd < b1*W1 + ... + bd*Wd

The calculation of these suitable degrees are delegated to the Degrees class, which uses a Java implementation (Diophantine Solver) to order the monomials using the weighted expression.

Rationale: The weighting scheme is in place because the number of model parameters had to be restricted in some way. De Geest et al. used such a weighting scheme before to discriminate between variables. The toolbox tries to select suitable values adaptively. In this way, it can eliminate variables which have no significant impact on the output (like in the Kotanchek example).

Please note that larger weights correspond to less important variables.

Two extra options are of interest:

1. Selection of base function (a function handle)
2. The frequencyVariable parameter (a variable name, or the keywords auto or off)

It is sometimes advantageous to use a different set of base functions. The default set is just the power function: 1, x, x^2, ... The toolbox provides two alternatives for this, the Legendre base functions, and the Chebyshev base functions. Each occurence of x^i in the above should be read as the value of the i'th base function in x.

When the frequencyVariable parameter resolves to a variable name, or when it is set to auto and there is a variable named f, freq or frequency, that variable is treated differently. First of all it is scaled to by strictly positive. To do this the standard interval [-1,1] is rescaled to [j,2*j], in order to represent a true complex frequency. Then, a standard RationalModel is built, using only real coefficients. Only use this feature when ComplexHandling is set to complex, otherwise it is pointless.