iknots_or_df | R Documentation |
Check order, degrees of freedom (df) and iknots
iknots_or_df(x, iknots, df, order)
x |
the support - a numeric vector |
iknots |
internal knots - a numeric vector |
df |
degrees of freedom - a numeric value of length 1 |
order |
polynomial order |
This is an internal function, not to be exported, and used in the calls for
bsplines
and bsplineD
.
Use iknots
preferentially. If iknots are not provided then return the
trimmed_quantile
for the appropriate df
and order
a numeric vector to use as the internal knots defining a B-spline.
bsplines
, bsplineD
,
trimmed_quantile
xvec <- runif(600, min = 0, max = 3)
# return the iknots
cpr:::iknots_or_df(x = xvec, iknots = 1:2, df = NULL, order = NULL)
# return the iknots even when the df and order are provided
cpr:::iknots_or_df(x = xvec, iknots = 1:2, df = 56, order = 12)
# return numeric(0) when df <= order (df < order will also give a warning)
cpr:::iknots_or_df(x = xvec, iknots = NULL, df = 6, order = 6)
# return trimmed_quantile when df > order
# probs = (df - order) / (df - order + 1)
cpr:::iknots_or_df(x = xvec, iknots = NULL, df = 10, order = 4)
cpr::trimmed_quantile(xvec, probs = 1:6 / 7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.