semipadd_cv_adapt: Compute semiparametric regression model using cv to choose...

View source: R/semipadd.R

semipadd_cv_adaptR Documentation

Compute semiparametric regression model using cv to choose the tuning parameter value

Description

Compute semiparametric regression model using cv to choose the tuning parameter value

Usage

semipadd_cv_adapt(
  Y,
  X,
  response,
  nonparm,
  w,
  d,
  xi,
  n.lambda = 5,
  lambda.min.ratio = 0.01,
  lambda.max.ratio = 1,
  n.folds = 5,
  lambda.beta = 1,
  lambda.f = 1,
  tol = 0.001,
  maxiter = 1000,
  report.prog = FALSE
)

Arguments

Y

the response data

X

the matrix with the observed covariate values (including a column of ones for the intercept)

response

a character string indicating the type of response. Can be "continuous", "binary", or "gt"

nonparm

a vector indicating for which covariates a nonparametric function is to be estimated

w

covariate-specific weights for different penalization for different covariates

d

vector giving the dimensions the B-spline bases to be used when fitting the nonparametric effects. If a scalar is given, this dimension is used for all nonparametric effects.

xi

a tuning parameter governing the smoothness of the nonparametric estimates

n.lambda

the number of lambda values with which to make the grid

lambda.min.ratio

ratio of the smallest lambda value to the smallest value of lambda which admits no variables to the model

lambda.max.ratio

ratio of the largest lambda value to the smallest value of lambda which admits no variables to the model

n.folds

the number of crossvalidation folds

lambda.beta

the level of sparsity penalization for the parametric effects (relative to nonparametric effects)

lambda.f

the level of sparsity penalization for the nonparametric effects (relative to the parametric effects)

tol

a convergence criterion

maxiter

the maximum allowed number of iterations

report.prog

a logical indicating whether the progress of the algorithm should be printed to the console

Value

Returns the estimator of the semiparametric additive model

Examples

data <- get_semipadd_data(n = 500, response = "binary")

semipadd_cv_adapt.out <- semipadd_cv_adapt(Y = data$Y,
                                           X = data$X,
                                           nonparm = data$nonparm,
                                           response = "binary",
                                           w = 1,
                                           d = 20,
                                           xi = 1,
                                           n.lambda = 5,
                                           lambda.min.ratio = .001,
                                           lambda.max.ratio = .1,
                                           lambda.beta = 1,
                                           lambda.f = 1,
                                           tol = 1e-3,
                                           maxiter = 1000,
                                           report.prog = TRUE)

plot_semipadd_cv_adapt(semipadd_cv_adapt.out, 
                       true.functions  = list( f = data$f,
                                               X = data$X))

gregorkb/semipadd2pop documentation built on Oct. 2, 2022, 1:37 p.m.