Package 'DTRKernSmooth'

Title: Estimate and Make Inference About Optimal Treatment Regimes via Smoothed Methods
Description: Methods to estimate the optimal treatment regime among all linear regimes via smoothed estimation methods, and construct element-wise confidence intervals for the optimal linear treatment regime vector, as well as the confidence interval for the optimal value via wild bootstrap procedures, if the population follows treatments recommended by the optimal linear regime. See more details in: Wu, Y. and Wang, L. (2021), "Resampling-based Confidence Intervals for Model-free Robust Inference on Optimal Treatment Regimes", Biometrics, 77: 465– 476, <doi:10.1111/biom.13337>.
Authors: Yunan Wu [aut, cre, cph], Lan Wang [aut]
Maintainer: Yunan Wu <[email protected]>
License: GPL (>= 2)
Version: 1.1.0
Built: 2025-02-19 04:59:03 UTC
Source: https://github.com/yunanwu123/dtrkernsmooth

Help Index


Make inference about the linear treatment regime vector and the optimal value

Description

This function estimates the optimal treatment regime among all linear regimes with smoothed estimation methods and doubly robust correction, and construct element-wise 100(1-alpha)% confidence intervals for the optimal linear treatment regime vector, and the 100(1-alpha)% confidence interval for the optimal value if the population follows treatments recommended by the optimal linear regime. It outputs a 'DTR.Boots.KernSmooth' model object

Usage

DTR.Boots.KernSmooth(
  X,
  y,
  a,
  intercept = TRUE,
  prob = 0.5,
  B = 500,
  alpha = 0.05,
  m0 = mean(y[a == 0]),
  m1 = mean(y[a == 1]),
  kernel = "normal",
  phi0 = 1,
  gamma = 2,
  err_tol = 1e-04,
  iter_tol = 200
)

Arguments

X

Input matrix, of dimension n_obs x n_vars; each row is an observation vector.

y

Response variable to be maximized on average if every subject follows the treatment recommended by the optimal regime.

a

Received treatments for n_obs subjects. Must be bivariate, and labeled as {0,1}.

intercept

Logical. TRUE (default) if the intercept is included in estimating the optimal treatment regime and FALSE if not.

prob

The propensity score for n_obs subjects, i.e., P(a=1|X). If NULL, it would be estimated by logistic regression a~X.

B

The number of repetitions in the inference procedure by weighted bootstrap. The default value is 500.

alpha

The confidence level of the confidence interval. The default value is 0.05.

m0

The estimated response values if the subjects receive treatment 0. The default is the average response value of all subjects who receive treatment 0.

m1

The estimated response values if the subjects receive treatment 1. The default is the average response value of all subjects who receive treatment 1.

kernel

The kernel function to be used in smoothed estimation. Should be one of "normal", "poly1" and "poly2". The default value is "normal". See more details in the "Details" section of DTR.KernSmooth.

phi0

The initial step size to be used in the Proximal Algorithm. The default value is 1.

gamma

The multiplier of the step sizes to be used in the Proximal Algorithm. Must be gamma > 1. The default value is 2.

err_tol

The desired accuracy in the estimation. The default value is 1e-4.

iter_tol

The maximum number of iterations in the estimation algorithm. The default value is 200.

Details

This function constructs confidence intervals for the optimal linear treatment regime vector by wild bootstrap procedures. The bootstrapped estimate of the smoothed robust estimator is defined as the vector β^\widehat{\bm{\beta}}^* that maximizes

n1i=1n[AiK(xiTβhn)+(1Ai){1K(xiTβhn)}]riYiπa(xi,ξ^)n1i=1n[Aiπa(xi,ξ^)]rim^1(xi)K(xiTβhn)+[1Aiπa(xi,ξ^)]rim^0(xi){1K(xiTβhn)}πa(xi,ξ^),n^{-1}\sum_{i=1}^n \frac{\left[A_i K\left(\frac{\bm{x}_i^T\bm{\beta}}{h_n}\right)+(1-A_i)\left\{1-K\left(\frac{\bm{x}_i^T\bm{\beta}}{h_n}\right)\right\}\right]r_iY_i}{\pi_a(\bm{x}_i, \widehat{\bm{\xi}})}- n^{-1}\sum_{i=1}^n \frac{\left[A_i-\pi_a(\bm{x}_i, \widehat{\bm{\xi}})\right]r_i\widehat{m}_1(\bm{x}_i)K\left(\frac{\bm{x}_i^T\bm{\beta}}{h_n}\right)+\left[1-A_i-\pi_a(\bm{x}_i, \widehat{\bm{\xi}})\right]r_i \widehat{m}_0(\bm{x}_i) \left\{1-K\left(\frac{\bm{x}_i^T\bm{\beta}}{h_n}\right)\right\}} {\pi_a(\bm{x}_i, \widehat{\bm{\xi}})},

with the second term as the doubly correction, where rir_i's are i.i.d N(1,1).
Let ξj(α/2)\xi_j^{\circ(\alpha/2)} and ξj(1α/2)\xi_j^{\circ(1-\alpha/2)} be the (α/2)(\alpha/2)-th and (1α/2)(1-\alpha/2)-th quantile of the bootstrap distribution of (nhn)1/2(β^jβ^j)(nh_n)^{1/2}(\widehat{\beta}_j^*-\widehat{\beta}_j), respectively, where α\alpha is a small positive number. We can estimate ξj(α/2)\xi_j^{\circ(\alpha/2)} and ξj(1α/2)\xi_j^{\circ(1-\alpha/2)} from a large number of bootstrap samples. An asymptotic 100(1α)%100(1-\alpha)\% bootstrap confidence interval for β0j\beta_{0j}, is given by

{β^j(nhn)1/2ξj(1α/2),β^j(nhn)1/2ξj(α/2)}.\left\{\widehat{\beta}_j-(nh_n)^{-1/2}\xi_j^{\circ(1-\alpha/2)}, \widehat{\beta}_j-(nh_n)^{-1/2}\xi_j^{\circ(\alpha/2)}\right\}.

To construct confidence intervals for the optimal value V(β0)V(\bm{\beta}_0), we define

Vn(β^)=n1i=1n[AiI(xiTβ^>0)+(1Ai)I(xiTβ^0)]riYiπa(xi,ξ^)n1i=1n[Aiπa(xi,ξ^)]rim^1(xi)I(xiTβ>0)+[1Aiπa(xi,ξ^)]rim^0(xi)I(xiTβ0)πa(xi,ξ^),V_n^*(\widehat{\bm{\beta}}) = n^{-1}\sum_{i=1}^n \frac{\left[A_i I\left(\bm{x}_i^T\widehat{\bm{\beta}}>0\right)+(1-A_i)I\left(\bm{x}_i^T\widehat{\bm{\beta}}\leq 0 \right) \right]r_iY_i}{\pi_a(\bm{x}_i, \widehat{\bm{\xi}})}- n^{-1}\sum_{i=1}^n \frac{\left[A_i-\pi_a(\bm{x}_i, \widehat{\bm{\xi}})\right]r_i \widehat{m}_1(\bm{x}_i)I\left(\bm{x}_i^T\bm{\beta}>0\right)+\left[1-A_i-\pi_a(\bm{x}_i, \widehat{\bm{\xi}})\right]r_i \widehat{m}_0(\bm{x}_i)I\left(\bm{x}_i^T\bm{\beta}\leq 0\right)} {\pi_a(\bm{x}_i, \widehat{\bm{\xi}})},

where rir_i's are i.i.d N(1,1). Let d(α/2)d^{\circ(\alpha/2)} and d(1α/2)d^{\circ(1-\alpha/2)} be the (α/2)(\alpha/2)-th and (1α/2)(1-\alpha/2)-th quantile of the bootstrap distribution of n1/2{Vn(β^)Vn(β^)}n^{1/2}\{V_n^*(\widehat{\bm{\beta}})-V_n(\widehat{\bm{\beta}})\}, respectively. An asymptotic 100(1α)%100(1-\alpha)\% bootstrap confidence interval for V(β0)V(\bm{\beta}_0) is

{Vn(β^)n1/2d(1α/2),Vn(β^)n1/2d(α/2)}.\left\{V_n(\widehat{\bm{\beta}})-n^{-1/2}d^{\circ(1-\alpha/2)}, V_n(\widehat{\bm{\beta}})-n^{-1/2}d^{\circ(\alpha/2)}\right\}.

See more details in the reference.

Value

An object of class "DTR.Boots.KernSmooth", which is a list containing the following components:

alpha

The confidence level of the confidence interval.

B

The number of repetitions in the inference procedure by weighted bootstrap.

smooth_est

The fitted "DTR.KernSmooth" object based on the input data and parameters.

Beta_CI

The 100(1-alpha)% confidence intervals for each element of the optimal treatment regime vector.

value_CI

The 100(1-alpha)% confidence interval for the optimal average response value among all linear treatment regimes.

Author(s)

Yunan Wu and Lan Wang
Maintainer: Yunan Wu <[email protected]>

References

Wu, Y. and Wang, L. (2021), Resampling-based Confidence Intervals for Model-free Robust Inference on Optimal Treatment Regimes, Biometrics, 77: 465– 476, doi:10.1111/biom.13337.

See Also

predict.DTR.Boots.KernSmooth, obj_value, DTR.KernSmooth

Examples

n <- 500; p <- 3
beta <- c(0.2,1,-0.5,-0.8)*0.7
beta1 <- c(1,-0.5,-0.5,0.5)

set.seed(12345)
X <- matrix(rnorm(n*p),n)
a <- rbinom(n,1,0.7)
mean1 <- exp(cbind(1,X) %*% beta1)
mean2 <- 8/(1 + exp(-cbind(1,X) %*% beta)) - 4
y <- mean1 + a * mean2 + rnorm(n)

boots_smooth_model_ci <- DTR.Boots.KernSmooth(X, y, a, prob = 0.4*a+0.3, B = 100)
boots_smooth_model_ci$Beta_CI
boots_smooth_model_ci$value_CI

## Not run: 
boots_smooth_model_ic <- DTR.Boots.KernSmooth(X, y, a, B = 100, m0 = mean1,
                                              m1 = mean1 + mean2)
boots_smooth_model_ic$Beta_CI
boots_smooth_model_ic$value_CI

boots_smooth_model_cc <- DTR.Boots.KernSmooth(X, y, a, prob = 0.4*a+0.3, B = 100,
                                              m0 = mean1, m1 = mean1 + mean2)
boots_smooth_model_cc$Beta_CI
boots_smooth_model_cc$value_CI

boots_smooth_model_ii <- DTR.Boots.KernSmooth(X, y, a, B = 100)
boots_smooth_model_ii$Beta_CI
boots_smooth_model_ii$value_CI

## End(Not run)

Estimate the optimal treatment regime among all linear regimes with smoothed estimation methods

Description

This function estimates the optimal treatment regime among all linear regimes with smoothed estimation methods and doubly robust correction, and outputs a 'DTR.KernSmooth' model object

Usage

DTR.KernSmooth(
  X,
  y,
  a,
  intercept = TRUE,
  prob = 0.5,
  m0 = mean(y[a == 0]),
  m1 = mean(y[a == 1]),
  kernel = "normal",
  phi0 = 1,
  gamma = 2,
  err_tol = 1e-04,
  iter_tol = 200
)

Arguments

X

Input matrix, of dimension n_obs x n_vars; each row is an observation vector.

y

Response variable to be maximized on average if every subject follows the treatment recommended by the optimal regime.

a

Received treatments for n_obs subjects. Must be bivariate, and labeled as {0,1}.

intercept

Logical. TRUE (default) if the intercept is included in estimating the optimal treatment regime and FALSE if not.

prob

The probability to receive the assigned treatments for the n_obs subjects, i.e., P(a=a_i|X_i). If NULL, it would be estimated by logistic regression a~X.

m0

The estimated response values if the subjects receive treatment 0. The default is the average response value of all subjects who receive treatment 0.

m1

The estimated response values if the subjects receive treatment 1. The default is the average response value of all subjects who receive treatment 1.

kernel

The kernel function to be used in smoothed estimation. Should be one of "normal", "poly1" and "poly2". The default value is "normal". See more details in "Details".

phi0

The initial step size to be used in the Proximal Algorithm. The default value is 1.

gamma

The multiplier of the step sizes to be used in the Proximal Algorithm. Must be gamma > 1. The default value is 2.

err_tol

The desired accuracy in the estimation. The default value is 1e-4.

iter_tol

The maximum number of iterations in the estimation algorithm. The default value is 200.

Details

This function estimates the optimal linear treatment regime to maximizes the average outcome among the population if every individual follows the treatment recommended by this treatment regime.
Assume the propensity score π(x)=P(A=1x)\pi(\bm{x})=P(A=1|\bm{x}) can be modeled as π(x,ξ)\pi(\bm{x},\bm{\xi}) where ξ\bm{\xi} is a finite-dimensional parameter (e.g., via logistic regression). Let ξ^\widehat{\bm{\xi}} be an estimate of ξ\bm{\xi}. LetLet πa(xi,ξ^)=Aiπ(xi,ξ^)+(1Ai)[1π(xi,ξ^)]\pi_a(\bm{x}_i, \widehat{\bm{\xi}})=A_i\pi(\bm{x}_i, \widehat{\bm{\xi}}) + (1-A_i)\left[1-\pi(\bm{x}_i, \widehat{\bm{\xi}})\right], and m^c(xi,β^)=I(xiTβ>0)m^1(xi)+I(xiTβ0)m^0(xi)\widehat{m}_c(\bm{x}_i, \widehat{\bm{\beta}}) = I\left(\bm{x}_i^T\bm{\beta}>0\right)\widehat{m}_1(\bm{x}_i) + I\left(\bm{x}_i^T\bm{\beta}\leq 0\right)\widehat{m}_0(\bm{x}_i) Hence, our goal is to estimate β\bm{\beta} which maximizes:

Vn(β)=n1i=1n[AiI(xiTβ>0)+(1Ai)I(xiTβ0)]Yiπa(xi,ξ^)n1i=1nAiI(xiTβ>0)+(1Ai)I(xiTβ0)πa(xi,ξ^)πa(xi,ξ^)m^c(xi,β^),V_n(\bm{\beta})=n^{-1}\sum_{i=1}^n \frac{\left[A_i I\left(\bm{x}_i^T\bm{\beta}>0\right)+(1-A_i)I\left(\bm{x}_i^T\bm{\beta}\leq 0\right)\right]Y_i} {\pi_a(\bm{x}_i, \widehat{\bm{\xi}})}- n^{-1}\sum_{i=1}^n \frac{ A_i I\left(\bm{x}_i^T\bm{\beta}>0\right)+(1-A_i)I\left(\bm{x}_i^T\bm{\beta}\leq 0\right) -\pi_a(\bm{x}_i, \widehat{\bm{\xi}})} {\pi_a(\bm{x}_i, \widehat{\bm{\xi}})}\widehat{m}_c(\bm{x}_i, \widehat{\bm{\beta}}),

with the second term as the doubly correction. For the identifiability, we normalize the estimator such that the second element has magnitude 1, i.e., β^2=1|\widehat{\beta}_2|=1.
To alleviates the computational challenge due to the nonsmooth indicator function, and derive asymptotic distribution of the estimators, we consider to use a smoothed function K()K(\cdot) to approximate the indicator function I()I(\cdot). That is, we will estimate β\bm{\beta} which maximizes:

n1i=1n[AiK(xiTβhn)+(1Ai){1K(xiTβhn)}]Yiπa(xi,ξ^)n1i=1n[Aiπa(xi,ξ^)]m^1(xi)K(xiTβhn)+[1Aiπa(xi,ξ^)]m^0(xi){1K(xiTβhn)}πa(xi,ξ^).n^{-1}\sum_{i=1}^n \frac{\left[A_i K\left(\frac{\bm{x}_i^T\bm{\beta}}{h_n}\right)+(1-A_i)\left\{1-K\left(\frac{\bm{x}_i^T\bm{\beta}}{h_n}\right)\right\}\right]Y_i} {\pi_a(\bm{x}_i, \widehat{\bm{\xi}})}- n^{-1}\sum_{i=1}^n \frac{\left[A_i-\pi_a(\bm{x}_i, \widehat{\bm{\xi}})\right] \widehat{m}_1(\bm{x}_i)K\left(\frac{\bm{x}_i^T\bm{\beta}}{h_n}\right)+\left[1-A_i-\pi_a(\bm{x}_i, \widehat{\bm{\xi}})\right] \widehat{m}_0(\bm{x}_i) \left\{1-K\left(\frac{\bm{x}_i^T\bm{\beta}}{h_n}\right)\right\}} {\pi_a(\bm{x}_i, \widehat{\bm{\xi}})}.

In this function, we provide three options for the smoothed kernel functions:

"normal"

The c.d.f of N(0,1) distribution. The bandwidth is set as hn=0.9n0.2min{std(xiTβ),IQR(xiTβ)/1.34}h_n=0.9n^{-0.2} \min\{std (\bm{x}_i^T\bm{\beta}),IQR(\bm{x}_i^T\bm{\beta})/1.34\}.

"poly1"

A polynomial function K(v)=[0.5+10564{v553(v5)3+75(v5)537(v5)7}]I(5v5)+I(v>5)K(v) =\left[0.5 + \frac{105}{64}\{\frac{v}{5}-\frac{5}{3}(\frac{v}{5})^3 +\frac{7}{5}(\frac{v}{5})^5 - \frac{3}{7}(\frac{v}{5})^7\}\right]I( -5\leq v \leq 5)+I(v>5). The bandwidth is set as hn=0.9n1/9min{std(xiTβ),IQR(xiTβ)/1.34}h_n=0.9n^{-1/9} \min\{std (\bm{x}_i^T\bm{\beta}),IQR(\bm{x}_i^T\bm{\beta})/1.34\}.

"poly2"

A polynomial function K(v)=[0.5+225128{v5149(v5)3+2125(v5)5}]I(5v5)+I(v>5)K(v) =\left[0.5 + \frac{225}{128}\{\frac{v}{5}-\frac{14}{9}(\frac{v}{5})^3 +\frac{21}{25}(\frac{v}{5})^5\}\right]I( -5\leq v \leq 5)+I(v>5). The bandwidth is set as hn=0.9n1/13min{std(xiTβ),IQR(xiTβ)/1.34}h_n=0.9n^{-1/13} \min\{std (\bm{x}_i^T\bm{\beta}),IQR(\bm{x}_i^T\bm{\beta})/1.34\}.

To solve the non-convexity problem of the optimization, we employ a proximal gradient descent algorithm for estimation. See more details in the reference.

Value

An object of class "DTR.KernSmooth", which is a list containing at least the following components:

X

The input matrix used.

y

The response variable used.

a

The treatment vector received by each subject.

intercept

Logical which indicates whether the intercept is included in estimating the optimal treatment regime.

prob

The propensity score vector for each subject.

m0

The estimated response values used if the subjects receive treatment 0.

m1

The estimated response values used if the subjects receive treatment 1.

kernel

The kernel function used in smoothed estimation.

beta_smooth

The estimated optimal treatment regime vector.

opt_treatment

The predicted optimal treatments for the input data given the estimated optimal regime.

value_smooth

The estimated optimal average response value among all linear treatment regimes.

converge

Logical. TRUE if the estimation algorithm converges, and FALSE if not.

iter_num

The number of iterations used for the algorithm convergence.

Author(s)

Yunan Wu and Lan Wang
Maintainer: Yunan Wu <[email protected]>

References

Wu, Y. and Wang, L. (2021), Resampling-based Confidence Intervals for Model-free Robust Inference on Optimal Treatment Regimes, Biometrics, 77: 465– 476, doi:10.1111/biom.13337.
Nesterov, Y. (2007). Gradient methods for minimizing composite objective function. Core discussion papers, Université catholique de Louvain, Center for Operations Research and Econometrics (CORE).

See Also

predict.DTR.KernSmooth, obj_value, DTR.Boots.KernSmooth

Examples

n <- 500; p <- 3
beta <- c(0.2,1,-0.5,-0.8)*0.7
beta1 <- c(1,-0.5,-0.5,0.5)

set.seed(12345)
X <- matrix(rnorm(n*p),n)
a <- rbinom(n,1,0.7)
mean1 <- exp(cbind(1,X) %*% beta1)
mean2 <- 8/(1 + exp(-cbind(1,X) %*% beta)) - 4
y <- mean1 + a * mean2 + rnorm(n)

smooth_model_ci <- DTR.KernSmooth(X, y, a, prob = 0.3 + 0.4*a, m0 = 0, m1 = 0)
smooth_model_ci$beta_smooth
smooth_model_ci$value_smooth

smooth_model_ic <- DTR.KernSmooth(X, y, a, m0 = mean1, m1 = mean1 + mean2)
smooth_model_ic$beta_smooth
smooth_model_ic$value_smooth

smooth_model_cc <- DTR.KernSmooth(X, y, a, prob = 0.3 + 0.4*a, m0 = mean1, m1 = mean1 + mean2)
smooth_model_cc$beta_smooth
smooth_model_cc$value_smooth

smooth_model_ii <- DTR.KernSmooth(X, y, a)
smooth_model_ii$beta_smooth
smooth_model_ii$value_smooth

Estimate the average response value of the input data given a treatment regime

Description

This function estimates the average response value of the input data given a 'DTR.KernSmooth' / 'DTR.Boots.KernSmooth' model object or an estimated optimal treatment regime vector, with doubly robust correction

Usage

obj_value(
  X,
  y,
  a,
  object,
  beta,
  prob = 0.5,
  m0 = mean(y[a == 0]),
  m1 = mean(y[a == 1])
)

Arguments

X

Input matrix, of dimension n_obs x n_vars; each row is an observation vector.

y

Response variable to be maximized on average if every subject follows the treatment recommended by the optimal regime.

a

Received treatments for n_obs subjects. Must be bivariate, and labeled as {0,1}.

object

Fitted "DTR.KernSmooth" or "DTR.Boots.KernSmooth" model object.

beta

The treatment regime vector. Cannot be missing if "object" is not provided.

prob

The propensity score for n_obs subjects, i.e., P(a=1|X). If NULL, it would be estimated by logistic regression a~X.

m0

The estimated response values if the subjects receive treatment 0. The default is the average response value of all subjects who receive treatment 0.

m1

The estimated response values if the subjects receive treatment 1. The default is the average response value of all subjects who receive treatment 1.

Details

object and beta cannot be both missing. If the input data (X, y, a) is missing but object is provided, the function will return the optimal value of the input object.

Value

The estimated average response value if all n_obs subjects follows the treatment recommendations according to the fitted model or the estimated treatment regime.

Author(s)

Yunan Wu and Lan Wang
Maintainer: Yunan Wu <[email protected]>

References

Wu, Y. and Wang, L. (2021), Resampling-based Confidence Intervals for Model-free Robust Inference on Optimal Treatment Regimes, Biometrics, 77: 465– 476, doi:10.1111/biom.13337.

See Also

DTR.KernSmooth, DTR.Boots.KernSmooth

Examples

n <- 500; p <- 3
beta <- c(0.2,1,-0.5,-0.8)*0.7
beta1 <- c(1,-0.5,-0.5,0.5)

set.seed(12345)
X <- matrix(rnorm(n*p),n)
a <- rbinom(n,1,0.7)
mean1 <- exp(cbind(1,X) %*% beta1)
mean2 <- 8/(1 + exp(-cbind(1,X) %*% beta)) - 4
y <- mean1 + a * mean2 + rnorm(n)

smooth_model <- DTR.KernSmooth(X, y, a, prob = 0.3 + 0.4*a)
boots_smooth_model <- DTR.Boots.KernSmooth(X, y, a, prob = 0.3 + 0.4*a, B = 100)

newn <- 1e4
newX <- matrix(rnorm(newn*p),newn)
newa <- rbinom(newn,1,0.5)
newmean1 <- exp(cbind(1,newX) %*% beta1)
newmean2 <- 8/(1 + exp(-cbind(1,newX) %*% beta)) - 4
newy <- newmean1 + newa * newmean2 + rnorm(newn)

obj_value(newX, newy, newa, smooth_model)
obj_value(newX, newy, newa, boots_smooth_model)
obj_value(newX, newy, newa, beta = smooth_model$beta_smooth)

Predict the optimal treatment given a 'DTR.Boots.KernSmooth' object

Description

This function predicts the optimal treatments for new subjects from a fitted DTR.Boots.KernSmooth model.

Usage

## S3 method for class 'DTR.Boots.KernSmooth'
predict(object, newX, ...)

Arguments

object

Fitted "DTR.Boots.KernSmooth" model object.

newX

Matrix of new values for X at which predictions are to be made.

...

Not used. Other arguments to predict.

Details

All the predicted optimal treatments are labeled as {0,1}.

Value

A vector of predicted optimal treatments for the new subjects given the fitted DTR.Boots.KernSmooth model.

Author(s)

Yunan Wu and Lan Wang
Maintainer: Yunan Wu <[email protected]>

References

Wu, Y. and Wang, L. (2021), Resampling-based Confidence Intervals for Model-free Robust Inference on Optimal Treatment Regimes, Biometrics, 77: 465– 476, doi:10.1111/biom.13337.

See Also

predict.DTR.KernSmooth, DTR.KernSmooth, DTR.Boots.KernSmooth

Examples

n <- 500; p <- 3
beta <- c(0.2,1,-0.5,-0.8)*0.7
beta1 <- c(1,-0.5,-0.5,0.5)

set.seed(12345)
X <- matrix(rnorm(n*p),n)
a <- rbinom(n,1,0.7)
mean1 <- exp(cbind(1,X) %*% beta1)
mean2 <- 8/(1 + exp(-cbind(1,X) %*% beta)) - 4
y <- mean1 + a * mean2 + rnorm(n)

boots_smooth_model <- DTR.Boots.KernSmooth(X, y, a, prob = 0.3 + 0.4*a, B = 100)
newn <- 10
newX <- matrix(rnorm(newn*p),newn)
predict(boots_smooth_model, newX)

Predict the optimal treatments given a 'DTR.KernSmooth' object

Description

This function predicts the optimal treatments for new subjects from a fitted DTR.KernSmooth model.

Usage

## S3 method for class 'DTR.KernSmooth'
predict(object, newX, ...)

Arguments

object

Fitted "DTR.KernSmooth" model object.

newX

Matrix of new values for X at which predictions are to be made.

...

Not used. Other arguments to predict.

Details

All the predicted optimal treatments are labeled as {0,1}.

Value

A vector of predicted optimal treatments for the new subjects given the fitted DTR.KernSmooth model.

Author(s)

Yunan Wu and Lan Wang
Maintainer: Yunan Wu <[email protected]>

References

Wu, Y. and Wang, L. (2021), Resampling-based Confidence Intervals for Model-free Robust Inference on Optimal Treatment Regimes, Biometrics, 77: 465– 476, doi:10.1111/biom.13337.

See Also

predict.DTR.Boots.KernSmooth, DTR.KernSmooth, DTR.Boots.KernSmooth

Examples

n <- 500; p <- 3
beta <- c(0.2,1,-0.5,-0.8)*0.7
beta1 <- c(1,-0.5,-0.5,0.5)

set.seed(12345)
X <- matrix(rnorm(n*p),n)
a <- rbinom(n,1,0.7)
mean1 <- exp(cbind(1,X) %*% beta1)
mean2 <- 8/(1 + exp(-cbind(1,X) %*% beta)) - 4
y <- mean1 + a * mean2 + rnorm(n)

smooth_model <- DTR.KernSmooth(X, y, a, prob = 0.3 + 0.4*a)
newn <- 10
newX <- matrix(rnorm(newn*p),newn)
predict(smooth_model, newX)