semipadd2pop_cv_adapt: Compute semiparametric binary-response regression model with...

View source: R/semipadd2pop.R

semipadd2pop_cv_adaptR Documentation

Compute semiparametric binary-response regression model with 2 data sets while penalizing dissimilarity using CV to select tuning parameters after an adaptive step

Description

Compute semiparametric binary-response regression model with 2 data sets while penalizing dissimilarity using CV to select tuning parameters after an adaptive step

Usage

semipadd2pop_cv_adapt(
  Y1,
  X1,
  nonparm1,
  Y2,
  X2,
  nonparm2,
  response,
  rho1,
  rho2,
  w1 = 1,
  w2 = 1,
  w = 1,
  nCom,
  d1,
  d2,
  xi,
  n.lambda = 5,
  n.eta = 5,
  lambda.min.ratio = 0.01,
  lambda.max.ratio = 1,
  eta.min.ratio = 0.001,
  eta.max.ratio = 10,
  n.folds = 5,
  lambda.beta = 1,
  lambda.f = 1,
  eta.beta = 1,
  eta.f = 1,
  tol = 0.001,
  maxiter = 1000,
  report.prog = FALSE
)

Arguments

Y1

the response data for data set 1

X1

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

nonparm1

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

Y2

the response data for data set 2

X2

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

nonparm2

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

response

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

rho1

weight placed on the first data set

rho2

weight placed on the second data set

w1

covariate-specific weights for different penalization among covariates in data set 1

w2

covariate-specific weights for different penalization among covariates in data set 2

w

covariate-specific weights for different penalization toward similarity for different covariates

nCom

the number of covariates to be treated as common between the two data sets: these must be arranged in the first nCom columns of the matrices X1 and X2 after the column of ones corresponding to the intercept.

d1

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.

d2

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

n.eta

the number of eta 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

eta.min.ratio

ratio of the smallest to largest value in the sequence of eta values

eta.max.ratio

controls the largest value of eta in the eta sequence

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)

eta.beta

the level of penalization towards model similarity for parametric effects indicated to be common (relative to nonparametric effects)

eta.f

the level of penalization towards model similarity for nonparametric effects indicated to be common (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_semipadd2pop_data(n1 = 500,n2 = 300,response = "continuous")

semipadd2pop_cv_adapt.out <- semipadd2pop_cv_adapt(Y1 = data$Y1,
                                                   X1 = data$X1,
                                                   nonparm1 = data$nonparm1,
                                                   Y2 = data$Y2,
                                                   X2 = data$X2,
                                                   nonparm2 = data$nonparm2,
                                                   response = "continuous",
                                                   rho1 = 2,
                                                   rho2 = 1,
                                                   w1 = 1,
                                                   w2 = 1,
                                                   w = 1,
                                                   nCom = data$nCom,
                                                   d1 = 25,
                                                   d2 = 15,
                                                   xi = .5,
                                                   n.lambda = 5,
                                                   n.eta = 5,
                                                   lambda.min.ratio = 0.01,
                                                   lambda.max.ratio = 0.10,
                                                   n.folds = 5,
                                                   lambda.beta = 1,
                                                   lambda.f = 1,
                                                   eta.beta = 1,
                                                   eta.f = 1,
                                                   tol = 1e-3,
                                                   maxiter = 1000,
                                                   report.prog = TRUE)

plot_semipadd2pop_cv_adapt(semipadd2pop_cv_adapt.out,
                           true.functions = list(f1 = data$f1,
                                                 f2 = data$f2,
                                                 X1 = data$X1,
                                                 X2 = data$X2))

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