Statistical Inference of the Value Function for Reinforcement Learning in Infinite Horizon Settings
C. Shi, S. Zhang, W. Lu, R. Song
Introduction
Reinforcement learning (RL) is a general technique that allows an agent to learn and interact with an environment. A policy defines the agent’s way of behaving. It maps the states of environments to a set of actions to be chosen from. RL algorithms have made tremendous achievements and found extensive applications in video games (Silver et al. 2016), robotics (Kormushev et al. 2013), bidding (Jin et al. 2018), ridesharing (Xu et al. 2018), etc. In particular, a number of RL methods have been proposed in precision medicine, to derive an optimal policy as a set of sequential treatment decision rules that optimize patients’ clinical outcomes over a fixed period of time (finite horizon). References include Murphy 2003; Zhang et al. 2013; Zhao et al. 2015; Shi et al. 2018a; Shi et al. 2018b; Zhang et al. 2018, to name a few.
Mobile health (or mHealth) technology has recently emerged due to the use of mobile devices such as mobile phones, tablet computers or wearable devices in health care. It allows health-care providers to communicate with patients and manage their illness in real time. It also collects rich longitudinal data (e.g., through mobile health apps) that can be used to estimate the optimal policy. Data from mHealth applications differ from those in finite horizon settings in that the number of treatment decision points for each patient is not necessarily fixed (infinite horizon) while the total number of patients could be limited. Take the OhioT1DM dataset (Marling and Bunescu 2018) as an example. It contains data for six patients with type 1 diabetes. For all patients, their continuous glucose monitoring (CGM) blood glucose levels, insulin doses including bolus and basal rates, self-reported times of meals and exercises are continually measured and recorded for eight weeks. Developing an optimal policy as functions of these time-varying covariates could potentially assist these patients in improving their health status.
In this paper, we focus on the infinite horizon setting where the data generating process is modeled by a Markov decision process (Puterman 1994, MDP,). Specifically, at each time point, the agent selects an action based on the observed state. The system responds by giving the decision maker a corresponding outcome and moving into a new state in the next time step. This model is generally applicable to sequential decision making, including applications from mHealth, games, robotics, ridesharing, etc. After a policy is being proposed, it is important to examine its benefit prior to recommending it for practical use. The goodness of a policy is quantified by its (state) value function, corresponding to the discounted cumulative reward that the agent receives on average, starting from some initial state. The inference of the value function helps a decision maker to evaluate the impact of implementing a policy when the environment is in a certain state. In some applications, it is also important to evaluate the integrated value of a policy aggregated over different initial states. For example, in medical studies, one might wish to know the mean outcome of patients in the population. The integrated value could thus be used as a criterion for comparing different policies.
In statistics literature, a few methods have been proposed to estimate the optimal policy in infinite horizons. Ertefaie and Strawderman 2018 proposed a variant of gradient Q-learning method. Luckett et al. 2019 proposed a V-learning to directly search the optimal policy among a restricted class of policies. Inference of the value function under a generic (data-dependent) policy has not been studied in these papers. In the computer science literature, Thomas et al. 2015 and Jiang and Li 2016 proposed (augmented) inverse propensity-score weighted ((A)IPW) estimators for the the value function in infinite horizons and derived their associated CIs. However, these methods are not suitable for settings where only a limited number of trajectories (e.g., plays of a game or patients in medical studies) are available, since (A)IPW estimators become increasingly unstable as the number of decision points diverges to infinity. Recently, Kallus and Uehara 2019 proposed a double reinforcement learning (DRL) method that achieves consistent estimation of the value under a fixed policy even with limited number of trajectories. Their method computes a Q-function and a marginalized density ratio. Learning the density ratio is challenging in general and it remains difficult to investigate the goodness-of-fit of the estimated density ratio in practice.
The focus of this paper is to construct confidence intervals (CIs) for a (possibly data-dependent) policy’s value function at a given state as well as its integrated value with respect to a given reference distribution. Our proposed CI is derived by estimating the state-action value function (Q-function) under the target policy. Similar to the value, the Q-function measures the discounted cumulative reward that the agent receives on average, starting from some initial state-action pair. We use series/sieve method to approximate the Q-function based on basis functions, where grows with the total number of observations. The advances of our proposed method are summarized as follows. First, the proposed inference method is generally applicable. Specifically, it can be applied to any fixed policy (either deterministic or random) and any data-dependent policy whose value converges at a certain rate. The latter includes policies estimated by general Q-learning type algorithms that learns an optimal Q-function from the observed data, such as gradient Q-learning (Maei et al. 2010; Ertefaie and Strawderman 2018), fitted Q-iteration (Ernst et al. 2005; Riedmiller 2005, see for example,), etc. See Section 3.2.4 for detailed illustrations.
Second, when applied to data-dependent policies, our method is valid in nonregular cases where the optimal policy is not uniquely defined. Inference without requiring the uniqueness of the optimal policy is extremely challenging even in the simpler finite-horizon settings (Luedtke and van der Laan 2016, see the related discussions in). The major challenge lies in that the estimated policy may not stabilize as sample size grows, making the variance of the value estimator difficult to estimate (see Section 3.2.1 for details). We achieve valid inference by proposing a SequentiAl Value Evaluation (SAVE) method that splits the data into several blocks and recursively update the estimated policy and its value estimator. It is worth mentioning that the data-splitting rule cannot be arbitrarily determined since the observations are time dependent in infinite horizon settings (see Section 3.2.2 for details).
Third, our CI is valid as long as either the number of trajectories in the data, or the number of decision points per trajectory diverges to infinity. It can thus be applied to a wide variety of real applications in infinite horizons ranging from the Framingham heart study (Tsao and Vasan 2015) with over two thousand patients to the OhioT1DM dataset that contains eight weeks’ worth of data for six people. We also allow both and to approach infinity, which is the case in applications from video games. In contrast, CIs proposed by Thomas et al. 2015 and Jiang and Li 2016 require to grow to infinity to achieve nominal coverage.
Lastly, we consider both off-policy and on-policy learning methods. In off-policy settings, CIs are derived based on historical data collected by a potentially different behavior policy. Off-policy evaluation is critical in situations where running the target policy could be expensive, risky or unethical. In on-policy settings, the estimated policy is recursively updated as batches of new observations arrive. To our knowledge, this is the first work on statistical inference of a data-dependent policy in on-policy settings in sequential decision making with infinite horizons.
To study the asymptotic properties of our proposed CI, we focus on tensor-product spline and wavelet series estimators. Our technical contributions are described as follows. First, we introduce a bidirectional-asymptotic framework that allows either or to approach infinity. Our major technical contribution is to derive a nonasymptotic error bound for the spectral norm of sums of mean zero random matrices formed by the data transactions from MDP as a function of , and (see e.g., Lemma 3). This result is important in studying the limiting distribution of series estimators under such a theoretical framework.
Second, for policies that are estimated by Q-learning type algorithms such as the greedy gradient Q-learning, fitted Q-iteration and deep Q-network (Mnih et al. 2015), we relate the convergence rate of their values to the prediction error of the corresponding estimated Q-functions. We show in Theorems 3 and 4 that the values can converge at faster rates than the estimated Q-functions under certain margin type conditions on the optimal Q-function. To the best of our knowledge, these findings have not been discovered in the reinforcement-learning literature. Our theorems form a basis for researchers to study the value properties of Q-learning type algorithms. Moreover, our theoretical results are consistent with findings in point treatment studies where there is only one single decision point (Qian and Murphy 2011; Luedtke and van der Laan 2016, see e.g.,). However, the derivation of Theorems 3 and 4 is more involved since the value function in our settings is an infinite series involving both immediate and future rewards.
Third, when these basis functions are used, we mathematically characterize the approximation error of the Q-function as a function of , the dimension of the state variables, and the smoothness of the Markov transition function and the conditional mean of the immediate reward as a function of the state-action pair. This offers some guidance to practitioners on the choice of the number of basis functions , when some prior knowledge on the degree of smoothness of the aforementioned functions are available.
The rest of the paper is organized as follows. We introduce the model setup in Section 2. In Sections 3 and 4, we present the proposed off-policy and on-policy evaluation methods, respectively. Simulation studies are conducted to evaluate the empirical performance of the proposed inference methods in Section 5. We apply the proposed inference method to the OhioT1DM dataset in Section 6, Finally, we conclude our paper by a discussion section.
Optimal policy in infinite-horizon settings
for some transition function . Here, defines the next state distribution conditional on the current state-action pair. Moreover, suppose the following conditional mean independence assumption (CMIA) holds
for some reward function . By MA, CMIA automatically holds when is a deterministic function of and that measures the system’s status at time . The latter is satisfied in our real data application (see Section 6 for details) and is commonly assumed in the reinforcement learning literature. CMIA is thus weaker than this condition. MA and CMIA are important to guarantee the existence of an optimal policy (see (2.1)) and derive the bidirectional-asymptotic theory of the proposed CI (see the discussions below Theorem 1). We assume both assumptions hold throughout this paper.
Similar to Theorem 6.2.12 of Puterman 1994, we can show under the given conditions that there exists at least one optimal policy that satisfies
To better understand , we introduce the state-action function (Q-function) under a policy as
Let denote the optimal Q-function, i.e, . It can be shown that satisfies
where denotes the smallest maximizer when the argmax is not unique. Such a deterministic optimal policy may be appealing in medical studies. For example, in optimal dose studies, it is preferred to assign each patient the smallest optimal dose level to avoid toxicity.
Off-policy evaluation
Let denote the number of trajectories in the dataset. For the -th trajectory, let , and denote the sequence of actions, states and rewards, respectively. It is worth mentioning that the time points are not necessarily homogeneous across different trajectories. Suppose the data are generated according to a fixed policy , better known as the behavior policy such that
are i.i.d copies of . The observed data can thus be summarized as , where is the termination time of the -th trajectory. The goal of off-policy evaluation is to learn the value under a target policy , possibly different from .
Luckett et al. 2019 showed that the value function satisfies
Based on (3.5), they directly modelled the value function, constructed an estimator for the integrated value under their estimated optimal policy and proved that it is asymptotically normal (Luckett et al. 2019, see Theorem 4.3,).
Following their procedure, for a fixed policy , one might estimate nonparametrically and construct the CI using the resulting estimate. However, such an approach might not be appropriate for polices that are discontinuous functions of the covariates. To better illustrate this, notice that satisfies the following Bellman equation
When satisfies certain smoothness conditions (see Condition A1 below), we have
for any . Suppose is continuous for any . Then is continuous in for any and . When is a non-continuous function of , it follows from (3.6) that is not continuous either. However, many nonparametric methods, such as kernel smoothers and series estimation, require the underlying function to possess certain degree of smoothness in order to achieve estimation consistency. Notice that any non-constant deterministic policy has jumps and is not continuous at certain points (such as the optimal policy given in (2)). This poses significant challenges in performing inference to these policies.
To allow valid inference for both deterministic and random policies, we consider modelling the Q-function. Under CMIA, we have
As a result, the Q-function satisfies the following Bellman equation
Similar to (3.7), we can show the second term on the right-hand-side (RHS) of (3.7) is a smooth function of for any and . When is smooth, so is . To formally establish these results, we introduce the notion of -smoothness (also known as Hölder smoothness with exponent ) below.
Here, denotes the -th element of . For any , let denote the largest integer that is smaller than . Define the class of -smooth functions as follows:
When , we have . It is equivalent to require to satisfy . The notion of -smoothness is thus reduced to the Hölder continuity.
Under A1, there exists some constant such that for any policy and .
Lemma 1 implies the Q-function has bounded derivatives up to order . This motivates us to first estimate the Q-function and then derive the corresponding value estimators based on the relation . By the Bellman equation (3.8), we can show the Q-function satisfies
The above equation forms a basis of our methods to learn (see details in the next section). In contrast to Equation (3.5), the sampling ratio does not appear in (3.9). This is because is the only sampling action and no further actions are involved in (3.9). As a result, our method does not require correct specification of the behavior policy. Nor do we need to estimate it from the observed dataset. This is another advantage of modelling the Q-function over the value.
1.2 Method
We describe our procedure in this section. We propose to approximate based on linear sieves, which takes the form
where is a vector consisting of sieve basis functions, such as splines or wavelet bases (see for example, Huang 1998, for choices of basis functions). We allow to grow with the sample size to reduce the bias of the resulting estimates. Under certain mild conditions, there exist some that satisfy
for any . Recall that . Define ,
Let , we propose to estimate by
where denotes the upper -th quantile of a standard normal distribution, and
1.3 Theory
Following the behavior policy , the set of variables forms a time-homogeneous Markov chain. Its transition kernel is given by
(A2.) The Markov chain has an unique invariant distribution with some density function . The density functions and are uniformly bounded away from and .
(ii) The Markov chain is geometrically ergodic.
We make a few remarks. First, we do not require the limiting density function to be equal to the initial state density .
Finally, when , is stationary. Under Condition A3(ii), it follows from Theorem 3.7 of Bradley 2005 that is exponentially -mixing (see the proof of Lemma 3 for details). When , A3(ii) enables us to derive matrix concentration inequalities for . This together with A3(i) implies that is invertible, with probability approaching (wpa1). We remark that A3(ii) is not needed when is bounded.
By MA, CMIA and (3.9), the leading term on the RHS of (3.14) forms a mean-zero martingale (details can be found in Section E.5). As either or grows to infinity, the asymptotic normality follows from the martingale central limit theorem.
2 Inference of the value under an (estimated) optimal policy
For simplicity, we assume throughout this section. Consider an estimated policy , computed based on the data . The integrated value under is given by
We will require the value of to converge to some fixed policy (possibly different from ), i.e,
We begin by outlining the challenge of obtaining inference in the nonregular cases. Suppose . When the optimal policy is not unique, might not converge to a fixed policy, despite that its value converges (see (3.15)). To better illustrate this, suppose is computed by some Q-learning type algorithms, i.e,
To allow for valid inference, we use a sequential value evaluation procedure to construct the CI. That is, we propose sequentially estimating the optimal policy and evaluating its value using different data subsets. This allows us to treat the estimated optimal policy as known conditional on past observations (see Equation (E.37) in Appendix E.2). The martingale CLT can thus be applied to obtain the limiting distribution for our estimator (see (E.39) and the related discussions). We detail our procedure in the next section.
2.2 SAVE for the value under an (estimated) optimal policy
We begin by dividing into non-overlapping subsets, denoted by . At the -th step, we use the sub-dataset
As commented in the introduction, the data-splitting rule cannot be arbitrary. For any of the two tuples and , define an order if either or . For any , we require the following:
It remains to specify that satisfy (3.20). Consider some positive integers , . Assume and are divisible by and , respectively. Let and . We set . For any , , define a set by
Thus, each block contains data from trajectories with decision time points. Below, we introduce two special examples.
When only a few trajectories are available, we may set . Then, the blocks are constructed according to the times that decisions were being made.
When each trajectory contains a very short time period, we may set . Then, the observations are divided according to the trajectories they belong to.
Based on this order, we set where and are the unique positive integers that satisfy . For any , we have either or . Thus, the proposed data-splitting rule guarantees (3.20) holds for any .
In Theorem 2 below, we establish the validity of our CI in (3.21). It relies on Condition A3* and A4. A3* is very similar to A3 and we present the detailed definition in Appendix A to save space.
We provide a sketch for the proof of Theorem 2 in Appendix E.2.
2.3 Convergence of the value under an estimated optimal policy
For any , we use to denote an estimated optimal policy based on observations in . Let denote some consistent estimator for and denote the greedy policy with respect to (see Equation (3.2.1)).
(A5) Assume there exist some constants such that
where denotes the Lebesgue measure, the big- terms are uniform in , and if the set .
For each , the quantity measures the difference in value between and the policy that assigns the best suboptimal treatment(s) at the first decision point and follows subsequently. In point treatment studies, Qian and Murphy 2011 imposed a similar condition (Qian and Murphy 2011, see Equation (3.3),) to derive sharp convergence rate for the value under an estimated optimal individualized treatment regime. Here, we generalize their condition in infinite-horizon settings. A5 is also closely related to the margin condition commonly used to bound the excess misclassification error (Tsybakov 2004; Audibert and Tsybakov 2007).
The margin-type condition is mild. In Appendix A.3, we present detailed examples and show the condition holds under these examples. The following theorems summarize our results.
Assume A1, (3.22) and (3.23) hold. Suppose the following event occurs with probability at least for any finite ,
In Theorem 3, we require the estimated Q-function to satisfy certain uniform convergence rate. In Theorem 4 below, we relax this condition by assuming that the integrated loss converges to zero at certain rate.
It can be seen from Theorems 3 and 4 that the integrated value converges faster compared to the Q-function. We provide a sketch for the proofs of both theorems in Appendix E.3.
2.4 Applications
In this section, we provide several examples to illustrate the convergence rate of . The proposed methods can be applied to evaluating the values under these estimated policies. The algorithm in Example 1 requires to impose a linear model assumption for the optimal Q-function. The algorithm in Example 2 allows more general nonlinear and nonparametric models for the optimal Q-function.
Suppose we model by linear sieves . Then we can compute by minimizing the following projected Bellman error:
where . The above loss is non-smooth and non-convex as a function of . The estimator can be computed based on the greedy gradient Q-learning algorithm.
In fitted -iteration (FQI), the optimal Q-function is approximated by some nonparametric models indexed by . The parameter is iteratively updated by
Extensions to on-policy evaluation
We now extend our methodology in Section 3 to on-policy settings. The proposed CI is similar to that presented in Section 3.2.2 and applies to any reinforcement learning algorithms that iteratively update the estimated policy based on batches of observations. Let be a monotonically increasing sequence that diverges to infinity. At the -th iteration, define . The data observed so far can be summarized as . We compute the estimated policy based on these data. Then we determine the behavior policy as a function of and generate new observations
according to . To balance the exploration-exploitation trade-off, a common choice of is the -greedy policy with respect to .
Simulations
We consider three scenarios. In Scenarios (A) and (B), the system dynamics are given by
for , where and . In Scenario (A), we consider a completely randomized study and set to i.i.d Bernoulli random variables with expectation . In Scenario (B), we allow the treatment assignment mechanism to depend on the observed state. Specifically, we set and where denotes the th element in . The target policy we consider is designed as follows,
In Scenario (C), we consider a standard RL setting included in OpenAI Gym (Brockman et al. 2016): Cliff Walking. This RL example is detailed in Example 6.6 in Sutton and Barto 2018. The objective is to identify the optimal path from the starting point S to the destination point G without falling off the cliff (see Figure 1). This scenario corresponds to an episodic task where the agent will be sent instantly to the starting point wherever it steps into the cliff or arrives at the destination. We manually add some noises to the immediate rewards simulated by the OpenAI Gym to ensure that the system dynamics are not deterministic. We remark that this task is considered in Kallus and Uehara 2020 as well. The target policy is the optimal policy and the behavior policy is a 50-50 mixture of the optimal and uniform random policies.
The DRL estimator has been shown to be much more efficient than AIPW or IPW estimators (Thomas et al. 2015; Jiang and Li 2016). So we focus on comparing our approach with DRL. DRL requires the calculation of the Q-function, the marginalized density ratio and the behavior policy. Here, we treat the behavior policy as known and estimate the Q-function and the density ratio based on nonparametric sieve regression.
In Figure 2 and Table 1, we report the empirical coverage probabilities (ECPs) and average lengths (ALs) of CIs constructed by the proposed method, with different choices of and . It can be seen that our CI achieves nominal coverage in all cases. Its length decreases as increases. This is consistent with our theoretical findings where we show the proposed value estimator converges at a rate of under certain conditions (see the discussions below Theorem 1).
Comparing our method with DRL, it is clear that our CIs are in general narrower than those constructed by DRL. In addition, MSEs of the proposed value estimates are smaller than those based on DRL. This is consistent with our theoretical analysis in Appendix C.2 where we show the variance of our value estimator is strictly smaller than that based on DRL under certain conditions. In addition, it can be seen from Table 1 that ECPs of DRL are below 90% in Scenario (C).
2 Off-policy evaluation with an (estimated) optimal policy
In addition, we design a non-regular setting Scenario (D) where the actions do not have effects on the transition dynamics or the immediate rewards. Specifically, for any , we set
3 On-policy evaluation with an (estimated) optimal policy
Application to the OhioT1DM dataset
As commented in the introduction, this dataset contains eight weeks’ records of CGM blood glucose levels, insulin doses and self-reported life-event data for each of six patients with type 1 diabetes. To analyze this data, we divide these eight weeks into three hour intervals. The state variable is set to be a three-dimensional vector. Specifically, its first element is the average CGM blood glucose levels during the three hour interval . The second covariate is constructed based on the -patient’s self-reported time and the carbohydrate estimate for the meal. Suppose the patient has meals at time with the carbohydrate estimates . Define
where corresponds to the decay rate every five minutes. Here, we set . The third covariate is defined as an average of the basal rate during the three hour interval.
We discretize the action according to the amount of insulin injected in the three hour interval. Specifically, when the total amount of insulin delivered to the -th patient is greater than one unit. Otherwise, we set . The immediate reward is defined according to the Index of Glycemic Control (Rodbard 2009, IGC,), which is a non-linear function of the blood glucose levels. Specifically, we set
A large IGC indicates the patient is in good health status. We set the discount factor , as in simulations.
For the -th patient, we apply the double FQI algorithm to the data
to estimate a patient-specific optimal policy. Then we compute the estimator for the value function starting from the initial state variable . In addition, we extend our methodology in Section 5.2 to construct the confidence interval for the value difference where corresponds to the value under the behavior policy. See Appendix B.2 for details. In Figure 4, we plot our proposed CI for the value difference, for each of the six patients, when the initial starting time is either 8:00 am or 2:00 pm in Day 1. It can be seen that the estimated value differences are strictly positive in all cases. This implies that the optimal value is strictly larger than the observed discounted cumulative reward. In some cases, the lower bound of our CI is larger than zero. The difference is thus significant. In Figure 5, we fix the starting time to 8:00 am and plot the CI of the value difference with different . Results show a similar qualitative pattern. This suggests applying reinforcement learning algorithms could potentially improve some patients’ health status.
Discussion
We discuss the advantages and limitations among the proposed method and DRL when inferring the value under a fixed decision rule. Generally speaking, the proposed method results in narrower CIs and would be preferred in cases where -consistent estimation of the Q-function is feasible. This includes settings where the dimension of the state-vector is not large, as in our real data applications. In contrast, DRL would be preferred in ergodic environments with high-dimensional covariates where -consistent estimation of the Q-function is infeasible.
Specifically, in Appendix C.2, we consider settings where both the behavior policy and the target policy are nondynamic. Under certain conditions, we prove that the variance of the DRL estimator is strictly larger than that of the proposed estimator. This in turn implies that our method yields a narrower CI in general.
In addition, we remark that the CI constructed by DRL requires the data to be generated from an ergodic environment. In the Cliff Walking example, the data are generated by a mixture of the optimal and random policy. Since the agent will be sent instantly to the starting point wherever it steps into the cliff or arrives at the destination, the Markov chain formed by the state-action pair is no longer ergodic. It can be seen from Table 1 where ECP of the CI is well below the nominal level in the Cliff Walking example. Although our procedure also requires the ergodicity assumption (see Condition (A3)(ii)), this assumption is not necessary. It can be seen from the proof of Theorem 1 that our CI is valid as long as the random matrix stabilizes. This is consistent with the findings in Table 1 where our CI achieves nominal coverage in all cases.
However, to ensure the proposed CI is valid, we require the bias of our Q-estimator to decay at a rate of . Consequently, our estimator converges at a rate of . This rate might not be achievable in high-dimensions. In contrast, DRL requires a weaker condition. The CI based on DRL is valid when both the Q-estimator and the estimated marginalized density ratio converge at a rate of .
Another potential limitation of our method is that in cases where is close to a singular matrix, the resulting Q-estimator might suffer from over-fitting, leading to an unbounded outcome. In practice, we could add a ridge penalty to reduce over-fitting. We discuss in detail in Appendix D.4.
2 Number of basis functions
We outline a procedure to choose the number of basis function in this section. The idea is to simulate the model dynamics and select such that the resulting confidence interval achieves nominal coverage under the simulated model. Specifically, given the observed data , we propose to learn the conditional density function of given . Following Janner et al. 2019, we recommend to use a Gaussian distribution to model the conditional density function in practice,
The conditional mean can be estimated via nonparametric regression (e.g., random forest). Let denote the corresponding estimator. Given the set of estimated residuals the conditional covariance function can be estimated via regression as well. We remark that in addition to the Gaussian function, other density functions could be used to model the system dynamics as well.
The behavior policy can be similarly estimated via regression. Given an estimated behavior policy and , , we generate simulated trajectories to investigate the performance of the proposed CI with different choices of .
Finally, we choose such that the resulting CI is the shortest among all CIs whose coverage probabilities are above certain level (e.g., 93%) under the simulated environment.
In Appendix D.1, we investigate the finite sample performance of such a method and find that it performs reasonably well. We remark that alternative to the aforementioned method, cross-validation could be applied to select .
3 Sensitivity to the ordering of trajectories
The proposed sequential value evaluation procedure in Section 3.2 divides the data into blocks defined both by trajectories and by time. While there is a natural order in time, there does not appear to be a natural order in the trajectories. In Appendix D.2.3, we conduct additional simulation studies to investigate the sensitivity of our CI to the ordering of trajectories under Scenario (B). Results suggest that our CI is not overly sensitive under our simulation setting.
As suggested by one of the referees, we may aggregate CIs over multiple orderings in cases where the results depend strongly on the ordering of the trajectories. Dezeure et al. 2015 derived a CI for the regression coefficients in high-dimensional models by aggregating results over multiple sample splits using a quantile function. We can adopt their method to aggregate our CIs over multiple orderings. Alternatively, one may average the value estimates over sufficiently many orderings and apply similar methods developed in Wang et al. 2020; Shi et al. 2020a to derive the CI. However, these algorithms are much more time-consuming.
4 More on value-based method
In Section 3.1.1, we discuss a potential drawback of using nonparametric methods to directly model the value function. We remark that a kernel-type importance sampling estimator for the will not suffer from this issue, since it does not directly model the value function, but uses an inverse propensity-score weighted method instead. Both IPW and regression type estimators have their own merits. In general, IPWEs might suffer from a large variance whereas regression-based estimators might suffer from a large bias. There exist methods that combine both for more robust off-policy evaluation (Kallus and Uehara 2019; Uehara et al. 2020; Tang et al. 2020; Shi et al. 2021, see e.g.,). However, as commented in Section 7.1, they might yield larger CIs compared to our method.
5 Rate of convergence of Q-learning type algorithms
Through authors’ communication, we found a recent independent work by Hu et al. 2021 that derived a nonasymptotic error bound on the value of the estimated optimal policy computed by Q-learning type algorithms under the margin condition. Their results are consistent with our theoretical findings in Theorems 3 and 4 that show the value of the estimated optimal policy converges to the optimal value at a faster rate than the estimated Q-function.
References
Appendix A Some technical conditions
where denotes the total variation norm.
A.2 Conditions A3*
(ii) The Markov chain is geometrically ergodic.
We remark that Condition A3*(ii) is the same as A3(ii).
A.3 More on the margin condition
To better understand Condition A5, we consider a simple scenario where . Define . It follows that
As a result, (3.22) and (3.23) are equivalent to the followings:
for some . Then, with some calculations, we can show
Appendix B Additional details regarding the method
and stands for the number of elements in .
B.2 Value difference between the target and behavior policy
In this section, we outline a method to evaluate the value difference function between the target and behavior policy. We first consider the scenario where the target policy is a fixed policy. We next consider the scenario where the target policy is an estimated optimal policy. To simplify the presentation, we assume . The proposed method can be similarly extended to on-policy settings.
Consider a data-independent policy . We aim to evaluate the value difference function where is the unknown behavior policy. We first apply our method in Section 3.1.2 to compute an estimator value function for .
The resulting estimates for can be derived as . The corresponding estimator for is given by where denotes the sieve estimator for where
This yields the estimator for the value difference .
We next derive a confidence interval for VD based on . Similar to the proof of Theorem 1, we can show is equivalent to
where denotes the temporal difference error and denotes the population limit of . Note that the RHS can be rewritten as that corresponds to a sum of martingale difference. Its variance can be consistently estimated by where denotes some consistent estimator for based on , and . The confidence interval for VD is given by
B.2.2 Inference of the value difference under an estimated optimal policy
We begin by dividing the data into non-overlapping subsets . Similar to Section 3.2.2, we construct the value difference estimator by
where and denote the versions of VD and based on samples in only. The corresponding confidence interval is given by
where .
Finally, we remark that such a confidence interval might not be valid in the extreme case where the behavior policy is equal to a deterministic optimal policy. To elaborate, notice that when the behavior policy is deterministic, the second line of (B.32) equal zero. In addition, when for some optimal policy , the first line equals zero as well. In that case, would have a degenerate distribution. Suppose the estimated optimal policy is consistent for . Then might not have a tractable limiting distribution, leading to an invalid confidence interval.
To address this concern, we could redefine the inverse weights by for some , as in Luedtke and van der Laan 2017. This guarantees that these inverse weights are strictly greater than zero. A similar approach is employed by Shi et al. 2020b for testing the overall qualitative treatment effects in single-stage decision making. In addition, one could allow to depend on and . The resulting confidence interval would be valid as long as (Shi et al. 2020b, see e.g., Theorem 3.1 of). However, a potential limitation is that it would yield a conservative confidence interval when the truncation is active, as discussed in Luedtke and van der Laan 2017.
B.3 Double fitted QQ-iteration
In this section, we introduce our algorithm for computing the estimated optimal policy in our numerical studies. The proposed algorithm is based on FQI that recursively updates the estimated optimal Q-function by some supervised learning method (see Example 2 in Section 3.2.3). In FQI, at each iteration, a maximization over estimated Q-function is used as an estimate of the maximum of the true Q-function. This can lead to a significant positive bias (Sutton and Barto 2018). Hasselt 2010 proposed a double Q-learning method to reduce the maximization bias. Here, we apply similar ideas to FQI to compute the estimated optimal policy. We use a pseudocode to summarize our algorithm below.
In Algorithm 1, we can apply any non-parametric models indexed by to model the optimal Q-function. In our implementation, we set to be a linear combination of tensor product B-spline basis functions.
Appendix C Additional technical details
is positive semidefinite. It follows that
When is a deterministic policy, is a block diagonal matrix. To show A4(i) holds, it suffices to show
Suppose is the -greedy policy with respect to , i.e, , for any and satisfies , we have
The condition in (C.33) is automatically satisfied when A2 holds (Burman and Chen 1989; Chen and Christensen 2015, see, e.g.,).
C.2 Additional details on the variance comparison
We consider a randomized study where is a constant function of . In addition, we assume the target policy is nondynamic, i.e., for some and any . We impose the following conditions.
(C1) The process is stationary.
(C2) The temporal difference error is independent of .
We make some remarks. First, Condition (C1) is imposed to simplify the presentation. The same results hold as long as will converge to its stationary distribution. Second, the variances of our estimator and DRL are very difficult to analyse in general. Conditions (C2)-(C3) are imposed to simplify the calculation. Even when these conditions are violated, we expect the variance of the proposed estimator will be smaller in general, as reflected in our numerical study.
We next sketch a few lines to prove Theorem 5. Based on Theorem 1, the asymptotic variance of our estimator is given by
Using similar arguments in the proof of Theorem 16 of Kallus and Uehara 2019, we can show that the asymptotic variance of the DRL estimator equals
Under the given conditions, the above variance is equal to where . Consequently, it suffices to show
By the definition of and , the left-hand-side of (C.35) is equal to
As such, the left-hand-side of (C.35) is upper bounded by
C.3 Additional details on on-policy evaluation
In this section, we show our proposed CI in Section 4 achieves nominal converge. To simplify the analysis, we focus on the setting where is finite, and . When diverges, the sequences and shall be properly chosen to reduce the bias of the value estimates. We leave this for future research.
Similar to Appendix A.2, we assume the estimated policy with probability , for any . In on-policy settings, the behavior policy is a function of the estimated policy . For instance, when an -greedy policy is used to determine the behavior policy, then we have where denotes a uniform random policy. Let .
(A2’.) Assume and are uniformly bounded away from and on their supports.
(iii) There exists some constant such that
Proof of Theorem 6 is omitted for brevity.
Appendix D Additional numerical results
We apply the proposed method detailed in Section 7.2 to Scenario (B) where the treatment assignment mechanism depends on the observed state, to investigate the finite sample performance of the resulting CI. Specifically, we apply the random forest algorithm to learn the conditional mean function and the behavior policy . We assume is a constant function of and estimated it by
We use the tensor product B-spline basis for , as in Section 5. Note that the state is a two-dimensional vector, is selected among the set . Specifically, we choose such that the resulting CI is the shortest among all CIs whose coverage probabilities are above 93%. If no such CI exists, we select the CI with the highest coverage probability.
We report the ECP and AL of the resulting CI in the left and middle panels of Figure 7. It can been seen that ECP is close to the nominal level in all cases and AL decays as either or increases. In the right panel of Figure 7, we report the number of basis functions that is being selected most by the proposed method as a function of and (denote by ). It is clear from Figure 7 that increases with the total number of observations . This is consistent with the following intuition: as increases, more basis functions are needed to reduce the approximation error and guarantee the nominal coverage of the resulting CI.
D.2 Sensitivity analysis
In this section, we conduct the sensitivity test for the parameter in the number of basis . We consider the simulation of the off-policy evaluation with a fixed target policy in Section 5.1. For scenario (A), (B) and (C), we set , and the different ’s are chosen from . The result of the ECPs are plotted in Figure 8 where all the ECPs are close to the nominal coverage rate 0.95. It shows that the results of the coverage are not sensitive to the different choices of .
D.2.2 Sensitivity test for γ\gamma
In Figure 9, we report the ECP and AL of the proposed CI and the MSE of our value estimate under Scenario B where the target policy is fixed, with and . In Figure 10, we report the ECP and AL of the proposed CI and the MSE of our value estimate under Scenario B where the target policy is an estimated optimal policy, with and . It can be seen that findings are very similar to those with .
In Tables 4 and 5, we report the ECP, AL and MSE of the proposed method and DRL under Scenario (C) where the target policy is fixed, with and . It can be seen that the proposed CI achieves nominal coverage in all cases. When , ECP of the DRL method is well below the nominal level in all cases. When , the AL and MSE of the proposed CI are much smaller than those based on DRL.
D.2.3 Sensitivity test for the ordering of trajectories
We focus on Scenario (B), detailed in Section 5.1, to examine the sensitivity of the proposed CI to the ordering of trajectories. Specifically, we first randomly permute all trajectories with some fixed random seed. We next apply our SAVE procedure to construct the CI. We use three random seeds to generate different random permutations and depict the corresponding results in Figure 11. It can be seen that our method is not overly sensitive to the ordering of trajectories.
D.3 Additional settings
D.4 Additional real data results
We use our real data example to discuss the issue of over-fitting in this section. Specifically, we apply the proposed method in Section 3.2.2 to evaluate the optimal value starting from the initial state variable , for . When the initial starting time is 8:00 am in Day 1, CIs for Patient 5 and Patient 6 are and , respectively. Both upper bounds are positive. However, according to our definition, the immediate reward is nonpositive. As such, the value and Q-function shall be nonpositive as well. This reflects one of the drawback of the proposed method. The resulting Q-estimator might suffer from over-fitting, leading to an unbounded outcome.
Specifically, it is due to that the matrix is close to singular. Note that the regression coefficients are computed by solving the linear equation
In our data example, the number of basis function equals 12. As such, is a by matrix. When it is close to singular, the resulting Q-estimator might be unbounded.
To avoid offer-fitting, we note that in theory, is a positive definite matrix under Condition (A3)(i). This motivates us to compute by solving
where denotes the identity matrix. As long as satisfies , the proposed CI remains valid. In our real data example, we set . The resulting CIs for Patient 5 and Patient 6 are and . Both upper bounds are strictly negative.
Appendix E Technical proofs
The rest of the section is organized as follows. We first present the proof sketches for Theorems 1-4. We next present the detailed technical proofs.
We provide an outline for the proof in this section. The detailed proof can be found in Section E.5 of the supplementary article. We break the proof into three steps. In the first step, we show the estimator satisfies
In the second step, we show the linear representation in (3.14) holds. The proof of (3.14) relies on the convergence rate of established in the first step and some additional random matrix nequalities in Lemma 4.
In the last step, we show the leading term on the RHS of (3.14) is asymptotically normal, based on the martingale central limit theorem. The completes the proof of Theorem 1.
E.2 A sketch for the proof of Theorem 2
Similar to (3.19), for each , we have
where denotes the remainder term and
for some remainder term . Suppose and satisfy certain convergence rates. Combining (E.38) together with (E.37) yields,
due to our use of the inverse weighting trick. Theorem 2 thus follows from the martingale central limit theorem.
E.3 A sketch for the proofs of Theorems 3 and 4
For , define a time-dependent policy that executes at the first time points and then follows . By definition, we have and . Notice that
Let be the density function of conditional on , following the estimated policy at the first time points, we have
By A1, we have . Under the Markov assumption,
In addition, for any , by the definition of . Therefore, we obtain
E.4 Proof of Lemma 1
Since is -smooth for any , it suffices to show
is -smooth for any and any policy .
as . By the mean value theorem, we have
where for all . When , we have . It follows from Condition A1 that
When , exists and is bounded by for any , and . It follows from the mean value theorem that
In addition, it follows from A1 and (E.44) that
where denotes the Lebesgue measure. Using the same arguments, we can show for any -tuple of nonnegative integers that satisfies ,
Moreover, by A1, (E.44) and (E.45), we have for any -tuple with that
E.5 Proof of Theorem 1
There exists some constant such that
Suppose the conditions in Theorem 1 hold. We have as either or that , , , and wpa1.
for some constant . Let , and
The condition implies that , almost surely. By Lemma 1 and the definition of -smooth functions, we obtain that for any . It follows that
almost surely. In addition, it follows from (E.48) that
In the following, we show and as either , or .
Error bound for : Let denote the sub-dataset . By the Bellman equation in (3.9), MA and CMIA, we have
Notice that is a function of and only, we have for any that
By Markov’s inequality, we obtain . Combining this together with Lemma 3 yields that .
By Lemma 3, we have . Combining this together with (E.51) yields that .
This completes the first step of the proof.
Step 2: Using similar arguments in bounding in Step 1, we can show that and thus
Since , it follows from Lemma 4 that
By Lemma 3, we have , or equivalently, . This implies that for some constant and hence
by (E.56). Combining (E.57) together with (E.55) yields that
This completes the second step of the proof.
Let . Then we iteratively define as follows:
Let and . It follows that
By MA, CMIA and the Bellman equation in (3.9), we obtain that
Hence, the RHS of (E.59) forms a martingale with respect to the filtration , where stands for the -algebra generated by . To show the asymptotic normality, we use a martingale central limit theorem for triangular arrays (McLeish 1974, Corollary 2.8 of). This requires to verify the following two conditions:
where the first inequality follows from Cauchy-Schwarz inequality, the second inequality is due to (E.49), the third inequality is due to Lemma 2 and the fact that , and the last inequality follows from (E.56). Since , (a) is proven. To verify (b), notice that
This can be proven using similar arguments in bounding in the proof of Lemma 3. In view of (E.58) and (E.59), we have by Slutsky’s theorem that
and hence . This together with Lemma 3 and the condition yields that
Thus, it remains to show , or , by Lemma 3. In view of (E.60), it suffices to show , or equivalently,
Therefore, it remains to show , or equivalently,
Under the given conditions, we have and . This implies , and . Therefore, we have
E.6 Proof of Lemma 2
For B-spline basis, the assertion in (E.47) follows from the arguments used in the proof of Theorem 3.3 of Burman and Chen 1989. For wavelet basis, the assertion in (E.47) follows from the arguments used in the proof of Theorem 5.1 of Chen and Christensen 2015.
E.7 Proof of Lemma 3
Part 1: It follows from Cauchy-Schwarz inequality that
where , is the marginal density of and
Part 2: We first consider Scenario (ii). Define the random matrix
By Lemma 2, we have and . It follows that
Moreover, using similar arguments in proving (E.64), we can show
For any , the marginal density function of is given by
This together with (E.65) and (E.66) yields
for some constant . Combining this together with (E.64), an application of the matrix concentration inequality (Tropp 2012, see Theorem 1.6 in) yields that
Set . Since is bounded, under the given conditions, will grow to infinity. For sufficiently large , we have and hence
Since and is bounded, we obtain . Thus, we can show that the following event occurs with probability at least ,
We aim to apply the matrix concentration inequality to the sum of independent random matrix (regardless of whether is bounded or not),
We begin by providing an upper error bound for . Let , for all , and be the -algebra generated by . Define
The sum forms a mean zero matrix martingale with respect to the filtration . Similar to (E.64) and (E.69), we can show
By the matrix martingale concentration inequality (Tropp 2011, Corollary 1.3,), we obtain the following occurs with probability at least ,
Conditional on , are independent mean zero random variables. Using similar arguments in proving (E.70), we can show that
for some constant , where the big- term is independent of . Thus, we obtain
This together with (E.71) implies that the following event occurs with probability at least ,
Notice that each is a function of only, with mean . Following Davydov 1973, define the -mixing coefficient of the stationary Markov chain as
Under the geometric ergodicity assumption in A3(ii) and , it follows from Lemma 1 of Meitz and Saikkonen 2019 that is exponentially -mixing. That is, for some and any . Using similar arguments in proving (E.64), we can show
Using similar arguments in proving (E.69), we can show
where . Suppose . Notice that . It follows from (E.74) that
Since , set , we obtain . Set , we obtain that
as either or . It follows from (E.76), (E.77) and the condition that the following event occurs with probability at least ,
Combining this together with (E.73) yields that the following event occurs with probability at least ,
By Bonferroni’s inequality, we obtain with probability at least that
for some constant . For , let denote the event
It follows from (E.79) that the following event occurs with probability at least ,
For any with , it follows from MA that is independent of given . Thus, we have
Similarly, conditional on , and are independent. It follows that
where and denote the -th row and -column of , respectively. Let be the -th element of . By Lemma 2 and the definitions of and ,
where the above bound is uniform for any pair that satisfies . Therefore, we have
and hence . This together with (E.81) and (E.82) yields that
Combining this with (E.79), an application of the matrix Bernstein inequality (Tropp 2012, Theorem 1.6 in) yields that
under the assumption that . This together with (E.79) yields that
by (E.78), (E.85) and the condition that . This together with (E.86) yields that
and hence .
Using similar arguments in Part 1, this implies is invertible and satisfies , with probability tending to . Therefore
with probability tending to . Since , we obtain . The proof is hence completed.
Since the matrix is block diagonal with the main-diagonal blocks . By Lemma 2 and Condition A2, we can show . As for , we have
where the first inequality follows from Jensen’s inequality. By Lemma 2, we can similarly show that . Thus, we obtain . The proof is hence completed.
E.8 Proof of Lemma 4
as . Using similar arguments as in the first part of the proof of Lemma 3, we can show that
as either , or . Using similar arguments in the third part of the proof of Lemma 3, we can show that
Since , it follows from (E.87) and (E.88) that the following event occurs with probability tending to ,
It remains to show and
Suppose (E.89) holds. By (E.88) and the condition that , we have . Thus, it suffices to show (E.89). This can be proven using similar arguments in Part 2 of the proof of Lemma 3. We omit the details for brevity. The proof is hence completed.
E.9 Proof of Lemma 5
It follows from Cauchy-Schwarz inequality and triangle inequality that
E.10 Proof of Theorem 2
Without loss of generality, we assume and such that for any . Under the given conditions, is bounded. Similar to Lemma 3, we can show under A4* that
We next bound the difference between and . Consider the scenario where is bounded first. Since , the data are divided according to the trajectories they belong to. Thus, for any , variables are independent of . Let
Using similar arguments in Part 2 of the proof of Lemma 3, we can show
with probability at least .
Now let us consider the scenario where . For , define to be the tuple in such that for any . Then, we have
Consider any with , are independent of . Using similar arguments in Part 2 of the proof of Lemma 3, we can show wpa1 that,
Consider with . We decompose as
Error bound for : Given , conditionally independent. Using the matrix concentration inequality, we can show wpa1 that
Error bound for : Given , the sets of variables are conditionally independent. Moreover, for any such that , the density function of conditional on is uniformly bounded under A3. Using similar arguments in bounding in Part 2 of the proof of Lemma 3, we can show wpa1 that
Combining (E.93) with (E.94) and (E.92), we obtain wpa1 that
wpa1, regardless of whether is bounded or not. Under the given conditions, we have . Using similar arguments in the proof of Lemma 3, we can show wpa1 that
Notice that . By Lemma 1, we have for any . Using similar arguments in the proof of Theorem 12.8 of Schumaker 1981 and proof of Proposition 5 of Meyer 1992, there exist some vectors that satisfy
for some constant . Similar to (E.50), we have by (E.97) that
Similar to the proof of Theorem 1, we have by (E.96) and (E.98) that
Using similar arguments in the proof of Theorem 1, we can show
Notice that . Under A5, we have
where denotes some positive constant. Since , we obtain that
By A6. By Markov’s inequality, we obtain that
Similar to Lemma 5, we can show that for any ,
Using similar arguments in the proof of Theorem 1, we can show
Similar to (E.57), we can show there exists some constant , such that the following occurs wpa1,
Combining this together with (E.100), we obtain that
The LHS of (E.103) can be further decomposed as
In the following, we show . Based on (E.101), one can show . Assertion (E.103) thus follows from Slutsky’s theorem.
For any , there exists some integer that satisfies . Let and be the integers that satisfy
Let . Then we iteratively define as follows:
Let and . We rewrite as
One can show that forms a mean-zero martingale with respect to the filtration . Using similar arguments in the proof of Theorem 1, we can show that
where .
Similar to the proof of Theorem 1, we can show . Similar to (E.56), we can show there exists some constant such that
Using a martingale central limit theorem for triangular arrays (McLeish 1974, Corollary 2.8 of), we have by (E.104) and (E.106) that . The proof is hence completed.
E.11 Proof of Theorem 3
Based on the discussions in Section 3.2.3, it suffices to show
We only prove (E.107) for brevity. Under the given conditions, we have , where
Under A1, is uniformly bounded. Therefore, the first term on the RHS of (E.108) is upper bounded by . Since can be chosen arbitrarily large, it suffices to show
Under the event defined in , we have
Let . Similarly, we can show the event occurs only when
Since , we obtain
where the first equality follows from A5. Combining this together with (E.111) yields (E.109). The proof is hence completed.
E.12 Proof of Theorem 4
For a given , let . Notice that
Using similar arguments in the proof of Theorem 3, we can show
Moreover, similar to (E.112), we can show the event occurs only when
Combining this together with (E.113) and (E.114) yields that
The proof is hence completed by setting .