1. Home
  2. FACPRODUCT procedure

FACPRODUCT procedure

Forms a factor with a level for every combination of other 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 ' '
LMETHOD = string token Whether to define levels for all combinations or only for those present in the data (all, present); default pres
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

FACTORS = pointers or formulae Factors contributing to each product
PRODUCT = factors Factors to be formed

Description

This procedure allows a factor to be formed whose levels represent all the combinations of a list of other factors. This may be useful, for example, if a design is generated by regarding a set of the treatments as though they were the factorial combinations of a list of factors in order to confound some of the contrasts, say, with blocks. It may then be very much easier to set up the levels of the factors in the list rather than those of the full treatment factor (which can then be formed by this procedure). Similarly, as shown in the example, it can be used to put the values in a multi-way table back into a variate, inserting the value in each cell of the table into the units with that level of the classifying factors.

The FACTORS parameter gives the list of factors from which the new factor is to be formed. These factors can be input in either a pointer or a model formula. The PRODUCT parameter specifies the identifier of the new factor.

The FLABELS option controls whether labels are formed for the new 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 levels (or labels, if available) of the original factors. The IMETHOD option controls whether the identifiers of the factors are included too, each one before its levels (or labels); by default they are excluded. The SEPARATOR option specifies the string to use to separate each identifier (if present) and level/label from the next, and the ISEPARATOR option specifies the string to use to separate the identifiers from the levels/labels; by default a single space is used for both of these.

Usually the PRODUCT factor has levels defined only for the combinations of levels of the factors that actually occur in the values that are formed. However, you can set option LMETHOD=all to request that there is a level for every combination (and this is the default when FLABELS=only).

Options: FLABELS, SEPARATOR, LMETHOD, ISEPARATOR, IMETHOD.

Parameters: FACTORS, PRODUCT.

Method

The FCLASSIFICATION directive is used, if necessary, to form lists of factors whose product is to be calculated. The levels for the factor are calculated according to the formula

level = 1 + ∑i=1…p { (mi – 1) × ni+1 × … × np }

where p is the number of factors in the list, mi is the ordinal level of factor i,

and ni is the number of levels of factor i (the ordinal levels for factor i are the numbers 1…ni). If LMETHOD=present, the levels are then renumbered to omit any that do not occur in the data.

Action with RESTRICT

If any of the factors is restricted, the levels will be formed only for the units not excluded by the restriction.

See also

Procedures: AFUNITS, FACCOMBINATIONS, FACDIVIDE, FBASICCONTRASTS, FDISTINCTFACTORS.

Commands for: Calculations and manipulation, Design of experiments.

Example

CAPTION    'FACPRODUCT example'; STYLE=meta
FACTOR     [LEVELS=!(1990,1991,1992); VALUES=5(1990...1992)] Year
FACTOR     [LABELS=!t(London,Manchester,Newcastle,Oxford,Sheffield);\
            VALUES=(1...5)3] Town
FACTOR     [LABELS=!t(South,North)] Region
CALCULATE  Region = NEWLEVELS(Town; !(1,2,2,1,2))
TABLE      [CLASSIFICATION=Year,Region; VALUES=99.50,95,110,105,125,125] Price
VARIATE    [NVALUES=15] Sales
READ       [PRINT=*] Sales
380 165 84 68 192  214 182 75 57 163  311 223 92 62 245 :
FACPRODUCT [LMETHOD=all] !p(Year,Region); Pfact
" The calculation works only if Price has no margins.
  Otherwise margins should be removed first, by putting
    MARGIN [METHOD=deletion] Price "
CALCULATE  Pval   = NEWLEVELS(Pfact; !(#Price))
&          Income = Sales * Pval
PRINT      Income,Sales,Year,Town,Region,Pfact,Pval;\
           FIELD=9,7,7,11,7,12,7; DECIMALS=2,5(0),2
Updated on March 8, 2019

Was this article helpful?