newknots: New Knots for CPs and CNs in CPR and CNR

View source: R/newknots.R

newknotsR Documentation

New Knots for CPs and CNs in CPR and CNR

Description

Non-exported function, newknots are used in the cpr and cnr calls. Used to create a new control polygon or control net from with different internal knots.

Usage

newknots(form, nk)

Arguments

form

a formula

nk

numeric vector, or a list of numeric vectors, to be used in a bsplines or btensor call, respectively.

Details

Think of this function as an analogue to the stats{update} calls. Where stats{update} will modify a call, the newknots will update just the iknots argument of a bsplines or btensor call within the formula argument of a cp or cn call.

Value

Expected use is within the cpr and cnr calls. The return object a formula to define a control polygon/net with different knots than then ones found within form.

See Also

update_bsplines for a more generic tool for the end user.

Examples


cp0 <- cp(log(pdg) ~ bsplines(day, iknots = c(-.25, 0, 0.25), bknots = c(-1, 1)), data = spdg)

new_knots <- c(-0.85, 0, 0.25, 0.3)
f <- cpr:::newknots(cp0$call$formula, nk = new_knots)
f
cp(f, data = spdg)


dewittpe/cpr documentation built on Feb. 16, 2024, 1:11 p.m.