Join the newly launched
Discord community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.model.knots.get_knot_info
Stay organized with collections
Save and categorize content based on your preferences.
Returns the number of knots, knot locations, and weights.
meridian.model.knots.get_knot_info(
n_times: int,
knots: (int | Collection[int] | None),
is_national: bool = False
) -> meridian.model.knots.KnotInfo
Args |
n_times
|
The number of time periods in the data.
|
knots
|
An optional integer or a collection of integers indicating the knots
used to estimate time effects. When knots is a collection of integers,
the knot locations are provided by that collection. Zero corresponds to a
knot at the first time period, one corresponds to a knot at the second
time, ..., and (n_times - 1) corresponds to a knot at the last time
period. When knots is an integer, then there are knots with locations
equally spaced across the time periods (including knots at zero and
(n_times - 1) . When knots is 1 , there is a single common regression
coefficient used for all time periods. If knots is None , then the
numbers of knots used is equal to the number of time periods. This is
equivalent to each time period having its own regression coefficient.
|
is_national
|
A boolean indicator whether to adapt the knot information for a
national model.
|
Returns |
A KnotInfo that contains the number of knots, the location of knots, and the
weights used to multiply with the knot values to get time-varying
coefficients.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["This function, `get_knot_info`, determines the necessary information about knots used for estimating time effects, including the number of knots, their locations, and associated weights."],["The `n_times` argument specifies the total number of time periods in the dataset that the knots refer to."],["The `knots` argument can be an integer, a collection of integers, or `None`, controlling the number and placement of knots across the time periods; when it is an integer, they will be equally spaced, when a collection, it directly indicates their locations, when `None`, each time period gets its own coefficient."],["The `is_national` boolean argument indicates if the knot information will need to be adjusted for a national model."],["The function ultimately returns a `KnotInfo` object, which encapsulates the calculated knot count, locations, and the corresponding weights."]]],["The function `get_knot_info` determines knot-related information for time-effect estimation. It takes `n_times` (number of time periods), optional `knots` (locations or count), and `is_national` (national model indicator) as input. If `knots` is a collection, these are used directly as locations; if an integer, knots are equally spaced; `None` equals each time period having its own knot. The output includes the total number of knots, their locations, and associated weights.\n"]]