orthoDr_pdose {orthoDr}R Documentation

Direct Learning & Pseudo-direct Learning Model

Description

Performs the "Direct Learning & Pseudo-direct Learning" Method for personalized medicine.

Usage

orthoDr_pdose(
  x,
  a,
  r,
  ndr = ndr,
  B.initial = NULL,
  bw = NULL,
  lambda = 0.1,
  K = sqrt(length(r)),
  method = c("direct", "pseudo_direct"),
  keep.data = FALSE,
  control = list(),
  maxitr = 500,
  verbose = FALSE,
  ncore = 0
)

Arguments

x

A matrix or data.frame for features (continuous only).

a

A vector of observed dose

r

A vector of observed reward

ndr

A dimension structure

B.initial

Initial B values. Will use the partial SAVE pSAVE as the initial if leaving as NULL. If specified, must be a matrix with ncol(x) rows and ndr columns. Will be processed by Gram-Schmidt if not orthogonal.

bw

A Kernel bandwidth, assuming each variables have unit variance

lambda

The penalty level for kernel ridge regression. If a range of values is specified, the GCV will be used to select the best tuning

K

A number of grids in the range of dose

method

Either "direct" or "pseudo_direct"

keep.data

Should the original data be kept for prediction

control

A list of tuning variables for optimization. epsilon is the size for numerically approximating the gradient. For others, see Wen and Yin (2013).

maxitr

Maximum number of iterations

verbose

Should information be displayed

ncore

the number of cores for parallel computing

Value

A orthoDr object consisting of list with named elements:

B

The optimal B value

fn

The final functional value

itr

The number of iterations

converge

convergence code

References

Zhou, W., Zhu, R., & Zeng, D. (2021). A parsimonious personalized dose-finding model via dimension reduction. Biometrika, 108(3), 643-659. DOI: doi:10.1093/biomet/asaa087

Examples

# generate some personalized dose scenario

exampleset <- function(size, ncov) {
  X <- matrix(runif(size * ncov, -1, 1), ncol = ncov)
  A <- runif(size, 0, 2)

  Edr <- as.matrix(c(0.5, -0.5))

  D_opt <- X %*% Edr + 1

  mu <- 2 + 0.5 * (X %*% Edr) - 7 * abs(D_opt - A)

  R <- rnorm(length(mu), mu, 1)

  R <- R - min(R)

  datainfo <- list(X = X, A = A, R = R, D_opt = D_opt, mu = mu)
  return(datainfo)
}

# generate data

set.seed(123)
n <- 150
p <- 2
ndr <- 1
train <- exampleset(n, p)
test <- exampleset(500, p)

# the direct learning method
orthofit <- orthoDr_pdose(train$X, train$A, train$R,
  ndr = ndr, lambda = 0.1,
  method = "direct", K = sqrt(n), keep.data = TRUE,
  maxitr = 150, verbose = FALSE, ncore = 2
)

dose <- predict(orthofit, test$X)

# ` # compare with the optimal dose
dosedistance <- mean((test$D_opt - dose$pred)^2)
print(dosedistance)

# the pseudo direct learning method
orthofit <- orthoDr_pdose(train$X, train$A, train$R,
  ndr = ndr, lambda = seq(0.1, 0.2, 0.01),
  method = "pseudo_direct", K = as.integer(sqrt(n)), keep.data = TRUE,
  maxitr = 150, verbose = FALSE, ncore = 2
)

dose <- predict(orthofit, test$X)

# compare with the optimal dose

dosedistance <- mean((test$D_opt - dose$pred)^2)
print(dosedistance)

[Package orthoDr version 0.6.8 Index]