Generate the control net for a uni-variable B-spline
Arguments
- x
a
cpr_btobject- ...
pass through
- theta
a vector of (regression) coefficients, the ordinates of the control net.
- formula
a formula that is appropriate for regression method being used.
- data
a required
data.frame- method
- method.args
a list of additional arguments to pass to the regression method.
- keep_fit
(logical, defaults to
FALSE). IfTRUEthe regression model fit is retained and returned in the thefitelement. IfFALSEthe regression model is not saved and thefitelement will beNA.- check_rank
(logical, defaults to
TRUE) if TRUE check that the design matrix is full rank.
Value
a cpr_cn object. This is a list with the following elements.
Some of the elements are omitted when the using the cn.cpr_bt method.
- cn
the control net,
data.framewith each row defining a vertex of the control net- bspline_list
A list of the marginal B-splines
- call
the call
- keep_fit
logical, indicates if the regression models was retained
- fit
if
isTRUE(keep_fit)then the regression model is here, elseNA.- coefficients
regression coefficients, only the fixed effects if a mixed effects model was used.
- vcov
The variance-covariance matrix for the
coefficients- loglik
The log-likelihood for the regression model
- rse
the residual standard error for the regression models
Details
cn generates the control net for the given B-spline function. There
are several methods for building a control net.
See also
summary.cpr_cn, cnr,
plot.cpr_cn for plotting control nets
Examples
acn <- cn(log10(pdg) ~
btensor( x = list(day, age)
, df = list(30, 4)
, bknots = list(c(-1, 1), c(44, 53))
)
, data = spdg)
str(acn, max.level = 1)
#> List of 12
#> $ cn :'data.frame': 120 obs. of 3 variables:
#> $ bspline_list:List of 2
#> $ call : language cn(formula = log10(pdg) ~ btensor(x = list(day, age), df = list(30, 4), bknots = list(c(-1, 1), c(44, 53))), data = spdg)
#> $ keep_fit : logi TRUE
#> $ fit :List of 12
#> ..- attr(*, "class")= chr "lm"
#> $ theta : num [1:120] -8.419 -0.293 -0.519 -0.181 -0.316 ...
#> $ coefficients: Named num [1:120] -8.419 -0.293 -0.519 -0.181 -0.316 ...
#> ..- attr(*, "names")= chr [1:120] "btensor(x = list(day, age), df = list(30, 4), bknots = list(c(-1, 1), c(44, 53)))1" "btensor(x = list(day, age), df = list(30, 4), bknots = list(c(-1, 1), c(44, 53)))2" "btensor(x = list(day, age), df = list(30, 4), bknots = list(c(-1, 1), c(44, 53)))3" "btensor(x = list(day, age), df = list(30, 4), bknots = list(c(-1, 1), c(44, 53)))4" ...
#> $ vcov : num [1:120, 1:120] 387.92 -47.33 15.45 -6 2.97 ...
#> ..- attr(*, "dimnames")=List of 2
#> $ vcov_theta : num [1:120, 1:120] 387.92 -47.33 15.45 -6 2.97 ...
#> $ loglik : num -7737
#> $ rss : num 2703
#> $ rse : num 0.332
#> - attr(*, "class")= chr [1:3] "cpr_cn" "cpr_cn" "list"