zepid.base.create_spline_transform¶

zepid.base.
create_spline_transform
(array, n_knots=3, knots=None, term=1, restricted=False)¶ Creates spline dummy variables based on either user specified knot locations or automatically determines knot locations based on percentiles. Options are available to set the number of knots, location of knots (value), term (linear, quadratic, etc.), and restricted/unrestricted.
Parameters:  array –
 n_knots (integer, optional) – Number of knots requested. Options for knots include any positive integer if the location of knots are specified. If knot locations are not specified, n_knots must be an integer between 1 to 7. Default is 3 knots
 knots (list, optional) – Location of specified knots in a list. To specify the location of knots, put desired numbers for knots into a list. Be sure that the length of the list is the same as the specified number of knots. Default is None, so that the function will automatically determine knot locations without user specification
 term (integer, float, optional) – High order term for the spline terms. To calculate a quadratic spline change to 2, cubic spline change to 3, etc. Default is 1, i.e. a linear spline
 restricted (bool, optional) – Whether to return a restricted spline. Note that the restricted spline returns one less column than the number of knots. An unrestricted spline returns the same number of columns as the number of knots. Default is False, providing an unrestricted spline
Returns:  function (a lambda function that accepts a numpy array or)
 list (a list of the knots)