# Splithalf

### Purpose

Performs splithalf validation of parafac and parafac2 models.

### Synopsis

- [result,fig] = splithalf(x,ncomp,options)
- [result,fig] = splithalf(x,model,options);
- fig = splithalf(result) % Plot results

### Description

A model is fitted on the whole dataset as well as on two independent halves. The resulting loadings are compared. If they are similar, the number of components used is feasible.

The similarity between components is calculated by an uncorrected correlation (Tuckers congruence) for each pair of vectors in the variable modes. The similarity is measured using the best possible ordering of components in the two splits - because the components may not come out in the same order. Each vector in each splits is compared to each other by congruence and multiplied with the congruence of each vectors similarity to the overall model to correct for unreasonable solutions (where the overall model is different from the two splits). These similarities are then multiplied for each variable mode. So in a three-way array with samples in the first mode, the similarities are combined from two and three. The result is a number between 0 (bad) and 1 (perfect). It is saved in result.splithalf.quality and it is multiplied with 100 to turn it into a percentage in the figure.

#### Inputs

**x**= data (2-way array class "double" or "dataset"), requires at least 3 samples.**nocomp**= number of components to use in PARAFAC.

#### Optional Inputs

= discussed below.**options**

#### Outputs

**results**= a structure containing the main results in results.splithalf.**fig**= the figure number created for the plotted results (if any).

### Options

**options** = structure array with the following fields :

**display**: [ { 'on' } | 'off' ] governs display at command line.**plots**: [ { 'on' } | 'off' ] governs plotting.**waitbar**: [ { 'on' } | 'off' ] governs display of waitbar for splithalf looping (separate from modeloptions.waitbar which governs individual model building waitbars)**splitmethod**: [ { 'default' } | 'random' ] [set to default to test AB/CD and AC/BD]. This means that the samples are arranged as [A B C D] and then first the first half (AB) is modelled and compared to the last half (CD). Independently, a model on the samples AC is compared to BD. The one of the two that works best (highest similarity) is plotted and used. Alternatively, set to 'random' to split the dataset randomly into two groups if your data are ordered, so that certain phenomena are only expected in certain parts.

**modeloptions**: for PARAFAC, the default options (parafac('options')) can be given or modified as desired. If you need to splithalf validate a PARAFAC2 models, simply input PARAFAC2 options (parafac2('options')).

### See Also

parafac, parafac2