spline2ph {sleev} | R Documentation |
Splines for two-phase regression functions
Description
Creates splines for two-phase regression function in this package, including linear2ph
, logistic2ph
, cv_linear2ph
, cv_logistic2ph
.
Usage
spline2ph(
x,
data,
size = 20,
degree = 3,
bs_names = NULL,
group = NULL,
split_group = TRUE
)
Arguments
x |
Column names of the covariate of the dataset. |
data |
Specifies the name of the dataset. This argument is required. |
size |
Pass on to the |
degree |
Pass on to the |
bs_names |
Optional. Vecotr of column names of the output B-spline basis matrix. When not specified, a default will be provided. |
group |
Optional. Column name of the categorical variable of which might have heterogeneous errors among different groups. |
split_group |
Optional. Whether to split by group proportion for the group with B-spline size if the |
Details
This function can be directly applied for regression model with one or more error-prone continuous covariates.
Value
the data.frame
object including the original dataset and the B-spline bases.
Examples
# example code
data("mock.vccc")
sn <- 20
data.linear <- spline2ph(x = "VL_unval", data = mock.vccc, size = sn,
degree = 3, group = "Sex")