Forms a factor to indicate observations with identical values of a set of variates, texts or factors (R.W. Payne).

### Options

`FLABELS` = string token |
When to form labels (`always` , `ifredeclared` , `only` , `never` ); default `ifre` |
---|---|

`SEPARATOR` = text |
Separator to use when constructing labels; default `' '` |

`ISEPARATOR` = text |
Separator to use between identifiers and levels or labels; default `' '` |

`IMETHOD` = string token |
Whether to include identifiers in the labels (`include` , `omit` ); default `omit` |

### Parameters

`VECTORS` = pointers |
Pointers containing sets of vectors (variates, and/or factors, and/or texts) |
---|---|

`FACTOR` = factors |
Saves a factor for each set of vectors with a level for every different combination of their values |

### Description

`FACCOMBINATIONS`

forms a factor whose levels identify the units that share the same combinations of values of a set of vectors (i.e. variates, factors or texts). The vectors are specified, in a pointer, by the `VECTORS`

parameter, and the factor to be formed is specified by the `FACTOR`

parameter.

This may be useful, for example, in regression analyses if you want to assess the lack of fit of a particular model. Suppose you have a multiple linear regression with explanatory variates `X1`

, `X2`

and `X3`

. If the data set contains units that have identical values for `X1`

, `X2`

and `X3`

, we can use these to obtain an estimate of the true residual variation, which can then be compared with the lack of fit of the model. If we put

`FACCOMBINATIONS !p(X1,X2,X3); FACTOR=X123`

the factor `X123`

will have a level for every combination of `X1`

, `X2`

and `X3`

values that occurs in the data set. The residual sum of squares is then given by the sum of squares within the levels of `X123`

, and the difference between the residual sum of squares of the model and the `X123`

sum of squares represents the lack of fit. (`FACCOMBINATIONS`

is used in exactly this way within procedure `FITINDIVIDUALLY`

.)

The `FLABELS`

option controls whether labels are formed for the `FACTOR`

, with settings:

`always` |
labels are always formed, |
---|---|

`ifredeclared` |
labels are formed only if the new factor has not been declared already with the correct number of levels (default), |

`only` |
only labels are formed (i.e. with this setting the factor is not given any values), and |

`never` |
labels are never formed. |

The labels are constructed by listing the values of the original factors. The `IMETHOD`

option controls whether the identifiers of the vectors are included too (each one before its values); by default they are excluded. The `SEPARATOR`

option specifies the string to use to separate each identifier (if present) and value from the next, and the `ISEPARATOR`

option specifies the string to use to separate the identifiers from the values; by default a single space is used for both of these.

Options: `FLABELS`

, `SEPARATOR`

, `ISEPARATOR`

, `IMETHOD`

.

Parameters: `VECTORS`

, `FACTOR`

.

### Action with `RESTRICT`

If any of the vectors is restricted, the values of the factor will be formed only for the units not excluded by the restriction.

### See also

Procedures: `AFUNITS`

, `FACDIVIDE`

, `FACPRODUCT`

, `FBASICCONTRASTS`

, `FDISTINCTFACTORS`

.

Commands for: Calculations and manipulation, Design of experiments.

### Example

CAPTION 'FACCOMBINATIONS example'; STYLE=meta SPLOAD '%GENDIR%/Data/Sulphur.gsh' " Form factor Lackoffit to represent combinations of Windsp & Winddir." FACCOMBINATIONS !p(Windsp,Winddir); FACTOR=Lackoffit PRINT Windsp,Winddir,Lackoffit CALCULATE Logsulphur = LOG10(Sulphur + 1) MODEL Logsulphur TERMS Windsp * Winddir + Lackoffit FIT [PRINT=*] Windsp * Winddir " Assess lack of fit of model." ADD [PRINT=accumulated; NOMESSAGE=aliasing; FPROB=yes] Lackoffit " No evidence of lack of fit, so return to Windsp*Winddir & print estimates." DROP [PRINT=estimates; TPROB=yes] Lackoffit