Shared Concepts

Spline Effects

You use a spline parameter to expand 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.

The variables in the vars parameter 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 subparameters:

basis='keyword'

specifies the type of basis used for the spline expansion. The following keywords are available:

bspline

uses a B-spline basis for the spline expansion. This is the default basis. 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 max left-brace d comma 1 right-brace 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 subparameters.

tpf_default

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, x squared comma ellipsis comma x Superscript d, 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 subparameter.

tpf_noint

the same basis as tpf_default excluding the intercept column.

tpf_nointandnopowers

the same basis as tpf_default excluding the intercept and polynomial columns.

tpf_nopowers

the same basis as tpf_default excluding the polynomial column.

dataBoundary=TRUE | FALSE

when set to True, 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=TRUE | FALSE

when set to True, displays tables that show the knot locations and the knots associated with each spline basis function.

knotMax=value

requests that, for each variable, 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 subparameter is also specified.

knotMethod={subparameter}

specifies how to construct the knots for spline effects. You can choose the method and affect the construction by specifying the following subparameters:

equal=n

specifies that n equally spaced knots be positioned between the extremes of the data. This is the default knot method, with n = 3. For a B-spline basis, any needed boundary knots continue to be equally spaced unless the dataBoundary subparameter has also been specified.

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 max left-parenthesis d comma 1 right-parenthesis entries in the list are used as right-side boundary knots.

multiscale={startScale=n | endScale=n}

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 2 Superscript i 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. If you specify multiple variables in the vars subparameter, 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 parameter. For example, the following spline parameter generates effects named spl_x1_S0, spl_x1_S1, spl_x1_S2, ellipsis, spl_x1_S7 and spl_x2_S1, spl_x2_S2, ellipsis, spl_x2_S7:

spline={{name="spl", vars={"x1", "x2"}, knotMethod={multiscale={}}}}

The multiscale subparameter is ignored if you specify a truncated power function basis.

The following subparameters 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.

rangeFractions={fraction-list}

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

spline={{name="spl", vars={"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 vars subparameter, 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 subparameter is also specified.

naturalCubic=TRUE | FALSE

when set to True, 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 spline parameter 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, i equals 1 comma 2 comma ellipsis comma n minus 2, 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 TPF_NOINT, TPF_NOPOWERS, and TPF_NOINTANDNOPOWERS bases to suppress the intercept and polynomial x when the columns of the natural cubic spline basis are formed. If you specify the naturalCubic subparameter, then the BSPLINE basis, the multiscale knot method, and the dataBoundary and degree subparameters are not applicable.

separate=TRUE | FALSE

when set to True, requests that, when multiple variables are specified in the vars subparameter, 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 name subparameter. For example, the following spline parameter generates the effect names spl_x1 and spl_x2:

spline={{name="spl", vars={"x1", "x2"}, separate=True}};

In actions that support variable selection, such as the regression.genmod action, these two effects can enter or leave the model independently during the selection process.

split=TRUE | FALSE

when set to True, 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 name subparameter. For example, the effects generated for the spline effect in the following spline parameter are spl_x1:1, spl_x1:2, …, spl_x1:7 and spl_x2:1, spl_x2:2, …, spl_x2:7:

spline={{name="spl", vars={"x1", "x2"}, split=True}};

Last updated: March 05, 2026