Shared Concepts

Spline Effects

This section discusses the construction of spline effects through the EFFECT statement. A spline effect expands variables into spline bases whose form depends on the options that you specify. For more information about regression splines and spline bases, see the section Splines and Spline Bases. You request a spline effect with the syntax

  • EFFECT name=SPLINE (var-list </ spline-options>);

The variables in var-list must be numeric. Design matrix columns are generated separately for each of these variables, and the set of columns is collectively referred to with the specified name. By default, the spline basis that is generated for each variable is a cubic B-spline basis that has three equally spaced knots positioned between the minimum and maximum values of that variable. This yields by default seven design matrix columns for each of the variables in the SPLINE effect.

You can specify the following spline-options after a slash (/):

BASIS=BSPLINE

uses a B-spline basis for the spline expansion. For splines of degree d that are defined with n knots, this basis consists of n + d + 1 columns. In order to completely specify the B-spline basis, d left-side boundary knots and right-side boundary knots are also required. For information about how to specify the positions of both the internal and boundary knots, see the KNOTMETHOD=, DATABOUNDARY, KNOTMIN=, and KNOTMAX= suboptions.

BASIS=TPF(options)

specifies a truncated power function basis for the spline expansion. For splines of degree d that are defined with n knots for a variable x, this basis consists of an intercept, polynomials x, , and one truncated power function for each of the n knots. Unlike the B-spline basis, no boundary knots are required. For information about how you can specify the position of the internal knots, see the KNOTMETHOD= suboption.

You can modify the number of columns when you request BASIS=TPF by specifying the following options:

NOINT

excludes the intercept column.

NOPOWERS

excludes the intercept and polynomial columns.

By default, BASIS=BSPLINE.

DATABOUNDARY

uses the extremes of the data as boundary knots when building a B-spline basis.

DEGREE=n

specifies the degree of the spline transformation, where n must be a nonnegative integer and is typically a small integer, such as 0, 1, 2, or 3. By default, DEGREE=3.

DETAILS

displays tables that show the knot locations and the knots associated with each spline basis function.

KNOTMAX=value

requests that, for each variable in the EFFECT statement, the right-side boundary knots be equally spaced starting at the maximum of the variable and ending at the specified value. This option is ignored for variables whose maximum value is greater than the specified value or if the DATABOUNDARY option is also specified.

KNOTMETHOD=knot-method<(knot-options)>

specifies how to construct the knots for spline effects. You can choose from the following knot-methods and affect the knot construction further with the method-specific knot-options:

EQUAL<(n)>

specifies that n equally spaced knots be positioned between the extremes of the data. By default, n = 3. For a B-spline basis, any needed boundary knots continue to be equally spaced unless the DATABOUNDARY option has also been specified. By default, KNOTMETHOD=EQUAL(3).

LIST(number-list)

specifies the list of internal knots to be used in forming the spline basis columns. For a B-spline basis, the data extremes are used as boundary knots.

LISTWITHBOUNDARY(number-list)

specifies the list of all knots that are used in forming the spline basis columns. When you use a truncated power function basis, this list is interpreted as the list of internal knots. When you use a B-spline basis of degree d, then the first d entries are used as left-side boundary knots and the last entries in the list are used as right-side boundary knots.

MULTISCALE<(multiscale-options)>

generates multiple B-spline bases, which correspond to sets that have an increasing number of internal knots. As the number of internal knots increases, the spline basis that is generated can approximate features of the data at finer scales. So generating bases at multiple scales facilitates the modeling of both coarse- and fine-grained features of the data. For scale i, the spline basis corresponds to equally spaced internal knots. By default, the bases for scales 0–7 are generated. For each scale, a separate spline effect is generated. The name of the constructed spline effect at scale i is formed by appending _Si to the effect name that you specify in the EFFECT statement. If you specify multiple variables in the EFFECT statement, then spline bases are generated separately for each variable at each scale and the name of the corresponding effect is obtained by appending the variable name followed by _Si to the name in the EFFECT statement. For example, the following statement generates effects named spl_x1_S0, spl_x1_S1, spl_x1_S2, , spl_x1_S7 and spl_x2_S1, spl_x2_S2, , spl_x2_S7:

EFFECT spl = spline(x1 x2 / knotmethod=multiscale);

The MULTISCALE option is ignored if you specify the BASIS=TPF spline-option.

The following multiscale-options control which scales are included:

STARTSCALE=n

specifies the start scale, where n is a positive integer. By default, STARTSCALE=0.

ENDSCALE=n

specifies the end scale, where n is a positive integer. By default, ENDSCALE=7.

PERCENTILES(n)

requests that internal knots be placed at n equally spaced percentiles of the variable or variables named in the EFFECT statement. For example, the following statement positions internal knots at the deciles of the variable x. For a B-spline basis, the extremes of the data are used as boundary knots:

EFFECT spl = spline(x / knotmethod=percentiles(9));
RANGEFRACTIONS(fraction-list)

places internal knots at each fraction of the ranges of the variables in the EFFECT statement. For example, if variable x1 ranges between 1 and 3 and variable x2 ranges between 0 and 20, then the following EFFECT statement uses internal knots 1.2, 2, and 2.5 for variable x1 and internal knots 2, 10, and 15 for variable x2:

EFFECT spl = spline(x1 x2 / knotmethod=rangefractions(.1 .5 .75));

For a B-spline basis, the data extremes are used as boundary knots.

KNOTMIN=value

requests that, for each variable in the EFFECT statement, the left-side boundary knots be equally spaced starting at the specified value and ending at the minimum of the variable. This option is ignored for variables whose minimum value is less than the specified value or if the DATABOUNDARY option is also specified.

NATURALCUBIC

uses a natural cubic spline basis for the spline expansion. Natural cubic splines, also known as restricted cubic splines, are cubic splines that are constrained to be linear beyond the extreme knots. The natural cubic spline basis that is produced by the EFFECT statement is obtained by starting from the unrestricted truncated power function cubic spline basis that is defined with n distinct knots and imposes the linearity constraints beyond the extreme knots. This basis consists of an intercept, the polynomial x, and n – 2 functions that are all linear beyond the largest knot. The ith function, , is 0 to the left of the ith knot, which is called the "break knot." For more information about this basis, see the section Splines and Spline Bases. You can use the NOINT and NOPOWERS suboptions of the BASIS=TPF option to suppress the intercept and polynomial x when the columns of the natural cubic spline basis are formed. When you specify the NATURALCUBIC option, the options BASIS=BSPLINE, DATABOUNDARY, DEGREE=, and KNOTMETHOD=MULTISCALE are not applicable.

SEPARATE

requests that, when multiple variables are specified in the EFFECT statement, the spline basis for each variable be treated as a separate effect. The names of these separated effects are formed by appending an underscore followed by the name of the variable to the name that you specify in the EFFECT statement. For example, the following statement generates the effect names spl_x1 and spl_x2:

EFFECT spl = spline(x1 x2 / separate);

In procedures that support variable selection, such as the GENSELECT procedure, these two effects can enter or leave the model independently during the selection process.

SPLIT

treats each individual column in the design matrix that corresponds to the spline effect as a separate effect that can enter or leave the model independently. Names for these split effects are generated by appending the variable name and an index for each column to the name that you specify in the EFFECT statement. For example, the effects generated for the spline effect in the following statement are spl_x1:1, spl_x1:2, …, spl_x1:7 and spl_x2:1, spl_x2:2, …, spl_x2:7:

EFFECT spl = spline(x1 x2 / split);

Last updated: December 21, 2018