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 df argument in splines::bs(). Degrees of freedom for EACH variable.

degree

Pass on to the degree argument in splines::bs(). Degree of the piecewise polynomial. Default is 3 for cubic splines.

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 group argument is provided. If FALSE, then the split will be averaged across all groups. Default is TRUE.

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")



[Package sleev version 1.1.4 Index]