Extracted main text — title through conclusion, appendix excluded. This is what our citation measures are computed over, published so the extraction can be checked by eye.
97,284 characters · 18 sections · 102 citation commands
Deep Learning for Individual Heterogeneity
Keywords: Deep Learning, Structural Modeling, Heterogeneity, Machine Learning, Neural Networks, Influence Functions, Neyman Orthogonality, Semiparametric Inference, Double Machine Learning.
\setcounter{page}{0} \thispagestyle{empty}
\onehalfspacing
Structural economic models are designed to obey theoretical and domain-specific restrictions emanating from the discipline. As a consequence, when taken to data, estimates and inferences from structural models are (economically) interpretable and directly useful for decisions, counterfactuals, and policy making. Crucially, in many economic decision problems, the structure of the model and the discipline it imposes afford meaningful interpolation and extrapolation which, in turn, facilitates the construction of counterfactuals and ultimately optimization.
Structural models are, however, potentially incomplete. Theory often does not specify every aspect of the framework we need to conduct empirical analysis. One critical element, and our focus in this paper, is the specification is heterogeneity. Even in cases where the presence of heterogeneity is implied by economic reasoning, the form and type is often unknown. As such, researchers must choose, or search for, a specification for heterogeneity that respects the structural assumptions of the model, as well as the practical considerations imposed by the data.
Often, the choice of the manner in which heterogeneity is modeled reflects the underlying objectives of the researcher. There are scenarios where one wishes to merely “control” for heterogeneity, since the key constructs of interest are not directly tied to it. In these cases, heterogeneity is treated as a nuisance parameter (or function). More recently, however, there has been a push to “exploit” heterogeneity by constructing individualized or personalized policies. Here, heterogeneity itself becomes a key quantity of interest. In these cases, we also will need to predict heterogeneity (for a new observation), and, as such, usual control-type methods (e.g. fixed effects) become less relevant. Targeting and personalization must be done on the basis of observable characteristics.
We argue that both the discipline of economic structure and the flexibility of machine learning (ML) tools are essential for heterogeneity-dependent constructs such as personalization policies, targeting, and counterfactuals. Both have their strengths and weaknesses, but, by combining them appropriately, one can use the strengths of each to remedy the shortcomings of the other. On one hand, theory and structure make optimization feasible and reliable, but do not dictate heterogeneity patterns. On the other hand, ML cannot learn economic structure with finite data (as argued and demonstrated below). Therefore, ML cannot take the place of economic theory and constraints, but flexibly learning patterns and heterogeneity is precisely the strength of modern ML. Thus, while ML cannot replace structural modeling, it can be useful to augment and enrich structure. We argue that economic structure and machine learning are complements in empirical modeling, not substitutes.
We show how to embed machine learning, in the form of modern deep neural networks (DNNs), into economic modeling. Our approach begins with a structural model imposed by the researcher. The model relates the outcomes $\by_i$ to the covariates of interest $\bt_i$ (treatments or policy-relevant variables) and depends on parameters of interest $\boldsymbol{\theta}$, which are to be estimated from the data. We suppose this structural model is captured by a loss function $\ell(\by_i, \bt_i, \boldsymbol{\theta})$. The structural model encodes restrictions and constraints on the data generating process and the parameters $\boldsymbol{\theta}$ have direct economic interpretations. From an econometric point of view, this is a standard parametric estimation and inference problem.
We then enrich the model by changing the parameters $\boldsymbol{\theta}$ into parameter functions $\boldsymbol{\theta}(\bx)$, which are fully flexible functions of a vector of observed characteristics $\bx_i$. The new model is then $\ell(\by_i, \bt_i, \boldsymbol{\theta}(\bx_i))$ (see Figure (ref) for a visual depiction of our framework). This change adds flexibility while maintaining all the structure and meaning of the original model. The incompleteness of theory is reflected in the flexibility of treating $\boldsymbol{\theta}(\bx_i)$ as a fully unknown function. This is exactly where the strength of machine learning is exploited, and how ML complements economic structure. Either one alone is insufficient: structure without machine learning would lose the richness and fail to capture important patterns in the data, while naively applying machine learning without structure would lose the interpretability and the utility in policy/decision making. As an aside, we note that this framework does nest some prior approaches to controlling for heterogeneity, but that is not our focus here.
The structural model allows for optimization, but the ML-enriched structure allows for individual-level optimization (i.e. for each unique $\bx$). This is useful for decision making and policy analysis at the individual level, answering “who gets what” questions regarding targeting and “what who gets” questions of personalization. The former is useful, for example, in deciding to which type of individuals we allocate a scarce resource or treatment, while the latter focuses on the assignment of different treatments to each individual.
We introduce a novel yet simple structural deep learning approach to estimate the parameter functions. The key to this approach is the architecture is depicted in Figure (ref). Neural networks allow the structure of the model to be directly encoded in the estimation through the network architecture. The expressive power of deep neural networks comes from the hidden layers. In standard approaches this flexibility is used to learn regression functions or form predictions, which determine both the target and the loss functions. In our approach, the hidden layers are directed through a parameter layer so that the power of ML is used entirely for learning the parameter functions. These then enter the model layer according to the structural model in order to optimize the loss. The required change to the architecture is intuitive and simple to implement. (See Figure (ref) for a direct comparison to regression.) The neural network optimizes the parameter functions to minimize the same structural loss, not prediction loss. This formalizes exactly how machine learning and structure are complementary. The ML enriches the economic model, filling in gaps left by theory. Simultaneously the economics aids the implementation of ML to estimate structural objects with economic meaning and interpretation. Our method allows for learning any economically interesting parameter, such as coefficients, variances, elasticities, et cetera, all as rich, heterogeneous functions.
To further build intuition, consider optimization of the network in Figure (ref). Neural network estimation relies on using gradients to find optima, proceeding by back propagation through the network. Our idea is simply to structure the final layers of this network, as shown in Figure (ref), optimizing the loss through the parameter functions, instead of optimizing prediction directly, but the computation is the same. This intuition also goes the other direction: parametric structural estimation of $\ell(\bY,\bT,\boldsymbol{\theta})$ would be optimized in exactly the same way, but the gradients would stop at the parameter layer. Our idea simply extends this through additional layers to add heterogeneity.
We theoretically justify this part of the methodology by proving nonasymptotic bounds, and implied convergence rates, for the structured deep neural networks (Theorem (ref)). This result generalizes Farrell-Liang-Misra2021_Ecma. These rates depend only on the dimension of the heterogeneity $\bx_i$, because the relationship of $\bt_i$ to $\by_i$ is not learned from the data. Our bounds apply to many settings of interest, requiring only mild conditions on the loss function $\ell(\cdot)$ and standard smoothness requirements, and thus may be of interest outside structural modeling.
We obtain valid inference by applying the the double machine learning methodology of Chernozhukov-etal2018_EJ, where the requisite orthogonal score is obtained from a novel and general influence function calculation (Theorem (ref)). Our insight here exploits the fact that we explicitly enrich a parametric model to obtain a two-step semiparametric setting, and in this case we show that ordinary derivatives can continue to characterize the influence function, just as in the parametric case. The influence function is thus known for a very wide class of models and parameters, and need not be newly derived in each case. Further, the only thing required is the value of these derivatives at the data points, not as functions in general. These may be known in advance or, importantly for practice, obtained using automatic differentiation engine built into neural network estimation without any human derivations needed. Collectively, this means we can deliver the influence function, and thus obtain valid inference via double machine learning, in more contexts than previously possible. This hopefully lessens the barriers to obtaining post-ML inference in practice.
We illustrate our methods and results by revisiting and extending the analysis of Bertrand-etal2010_QJE. The data is from a large scale field experiment run on behalf of a financial institution in South Africa. Consumers were sent marketing material for short terms loans where a number of features of the advertising content and the interest rate offered were randomized. As in the original paper, we employ a binary choice model, one of the workhorse models in applied economics, but we enrich the model to capture heterogeneity. We then model demand as a function of prices and marketing efforts, and once the demand function is estimated, we compute optimal prices as a function of characteristics (third degree price discrimination) and conduct inference on quantities such as counterfactual profits. This involves applying double machine learning ideas to objects not available in closed form (the solution to a fixed point problem), which illustrates the generality of our inference method.
The rest of the paper is organized as follows. We next review some related literature. Section (ref) then shows a simple, motivating example demonstrating why neither structural models nor machine learning individually suffice. Our framework for structured deep learning and subsequent inference is described in Section (ref). We then apply these ideas in Section (ref). Section (ref) summarizes the theoretical results and Section (ref) concludes. The Appendix gives all proofs, further discussion of related contexts, and thorough discussion of the important and intuitive special case of generalized linear models in order to illustrate the ideas and connect to other results.
Our work touches on several areas of economics, econometrics, and statistics, to which we cannot hope to do justice in a few paragraphs. We will give an overview here, with some further discussion is given throughout the paper.
First, at a broad level, our work is related to the recent interest in integrating ML into economic research. A large part, if not all, of this work has used ML to learn regression functions or make predictions, even if these feature in other economic contexts. ML is often a substitute for nonparametric regression, and succeeds where classical methods fail due to complexities or limitations of the data. Outside of pure prediction, causal inference is often the end goal, but our work, being motivated by structure, extends to a breath of economic contexts. For recent reviews in this space, with differing focuses, see Varian2014_JEP, Bajari-etal2015_AERPP, Mullainathan-Spiess2017_JEP, and Athey-Imbens2019_ARE.
Although it is not our focus per se, our work is related to literature on heterogeneous treatment effects Athey-Imbens2016_PNAS,Chernozhukov-etal2018_generic and through it to the topics of personalization and targeting Dube-Misra2023_JPE,agrawal2022personalizedrecommendationsedtechevidence,Hitsch-Misra-Zhang2024_QME. Our embedding of deep neural networks into structural models affords the estimation of heterogeneous parameter functions across a broad array of applications and the potential to generate personalized policies. We demonstrate its use in the context of personalized interest rates in our application section.
On the theoretical front, the structured deep learning approach we propose, and the accompanying nonasymptotic bounds, connect our work to the recent literature studying the statistical properties of ML methods. Our theoretical results build directly upon and generalize Farrell-Liang-Misra2021_Ecma. Conceptually, Athey-Tibshirani-Wager2019_AoS and Foster-Syrgkanis2023_AoS may be the most closely related, as both focus on quantities other than prediction functions, use models beyond regression, and utilize orthogonal scores as key ingredients. The contexts and results are different, as we focus on deep learning and semiparametric inference. Athey-Tibshirani-Wager2019_AoS study random forests and nonparametric inference, while Foster-Syrgkanis2023_AoS are concerned with risk bounds under weak conditions.
The use of influence functions explicitly with the goal of obtaining valid inference under weaker conditions is not new, whether for classical nonparametrics Cattaneo2010_JoE or machine learning Farrell2015_arXiv. Our work contributes most directly to the recent literature applying the double machine learning (DML) method of Chernozhukov-etal2018_EJ. DML combines sample splitting with an orthogonal score, which an influence function provides. Many applications of DML stick to contexts with well-known influence functions or hand-derive a new score. Our contribution here is the derivation of a generic influence function that covers a broad class of models and can be computed automatically. We share this goal with the “auto-DML” method (see Remark (ref) below); our approach is different and has relative strengths and weaknesses.
Most modern applications of personalized policy design require the ability to recover heterogeneous responses to some treatment(s) from data, and the facility to use those in an optimization framework to obtain improvements in the counterfactual. While the former can be done via use of the ML toolkit, the latter requires that the estimated response functions obey certain economic curvature and shape restrictions. As such, our choices are to either learn these constraints from data or impose them via structure. We demonstrate, with a simple example, that learning economic structure from finite date can be impossible but that structure is invaluable for decision making problems. To make the point clear we ignore heterogeneity and rely on the reader to extrapolate to the fact that the lessons here become even more important when recovering heterogeneity or personalization, because this creates greater demands on data. Our key point is that, structure imposes appropriate economic restrictions and constraints, and consequently data is used more efficiently to learn the heterogeneity.
The value of structure in economic modeling is well understood. Indeed, the half-century old Lucas Critique is a (major) example of the value of structural thinking. With the power of ML, there is a renewed temptation to learn everything from data alone. This view has its origins in the machine learning literature, which is focused on prediction, but has seeped into other contexts. Zadrozny2004_ICML writes, in the context of classification, that the ML community is “interested in the predictive performance of the model and not in making conclusions about the underlying mechanisms that generate the data.” So successful is machine learning, and deep learning in particular, at prediction tasks, that it can be tempting to assume that any problem can be tackled with accurate enough predictions. In the modern age of large language models and generative AI, this approach is even more appealing. But in contrast with those contexts, where prediction is sufficient, economic decision making cannot proceed without the “underlying mechanisms”, that is, without structure and economics. The danger in naively applying ML in decision making is that economic assumptions and structure are replaced with the statistical and computational assumptions and structure of estimators.
To illustrate, we will use the data of Bertrand-etal2010_QJE, which described and analyzed more fully in Section (ref). This context is ideal because, by focusing on a subset of the data, we find that this is simultaneously a straightforward demand estimation problem and straightforward prediction task, making both structural modeling and machine learning well-motivated. The context is demand for a short-term loan given its interest rate, and our goal is to estimate demand as a function of price and then derive the optimal interest rate offer. For 40,507 individuals we observe the binary outcome $y_i \in \{0,1\}$ indicating a loan application decision and the policy relevant variable $t_i = r_i$ giving the interest rate offered. The good being “purchased” is the loan and its price is captured by the interest rate. The interest rate $t_i = r_i$ is randomized, so there are no endogeneity concerns, and is furthermore continuous, taking on 46 unique values. With 40,507 observations on two variables, this is a tailor-made classification task, and the naive ML view would hold that if conversion for any interest rate offered can be predicted accurately, then demand function can be recovered, and finally the interest rate can be optimized. However, as we will see, neglecting the “underlying mechanisms that generate the data” will lead to a failure. If the unstructured approach fails in this context, adding heterogeneity is only more difficult.
Figure (ref) shows three different approaches to estimating the demand function in this data. In each case, the dots show the empirical application rate (average purchasing decision) at each offered interest rate. First we consider two ML approaches which treat this as purely a predication/classification task, and are thus based on the model
for an unknown function $\eta(r)$ to be nonparametrically estimated. Panel (a) shows two random forest estimates using the {\tt ranger} package in {\sf R}. The dotted orange line uses the default settings. This appears to be undersmoothed and thus the blue dashed line forces a smoother fit using an ad-hoc restriction on the tree depth. It is easy to (by eye) reject the default random forest as an unreasonable estimate of the demand function, although it should be noted that even this judgment requires economic theory, not statistical/ML criteria: nothing in machine learning says the curve should be smooth or downward-sloping. Panel (b) shows two neural network fits. The dotted orange line uses three hidden layers with 20, 50, and 20 nodes, respectively, for a flexible fit. Note that despite the richness, the fit does not appear to be overly complex. The blue dashed line uses two layers with 10 nodes each for a smoother fit (matching Section (ref)). Finally, panel (c) replaces (ref) with the basic workhorse structural model in industrial organization, namely a linear randomly utility model with a logistic errors, so that
where $G(u)$ is the logit function and $\theta^\star_1$ and $\theta^\star_2$ are the intercept and slope, respectively.
The smoothed-out forest and both neural networks produce curves that could reasonably be demand functions. However, as we continue with the pricing problem, it becomes clear how different are these fits. Panels (d) and (e) show the extrapolated estimated demand functions of the smoothed forest, the (10,10) neural network, and the binary choice model to interest rates of zero to 20% (panel (d)) and zero to 200% (panel (e)). Panel (f) then shows the implied revenue for each demand function estimate. While this does not include costs, it is clear what each estimate implies for an optimal price (see Section (ref) for more realistic profit optimization).
The forest fit is perhaps the most striking. Demand is completely flat for any higher interest rate, and therefore revenue grows without bound, and so the optimal price is infinite. This is both mechanical and a general phenomenon: a forest is an average of trees, which are piecewise constant, and therefore all extrapolation is based on a flat line, no matter the context or data. The neural network closely resembles the binary choice model on the support of the data, but when we extrapolate we see that the invisible complexities of the network yield very different demand and revenue curves. In contrast to both of these, the structural model gives well-behaved demand and revenue curves and yields a reasonable optimal price.
To conclude this example, several remarks are in order. (i) Students of all fields, including econometrics, statistics, and machine learning, are taught never to extrapolate a statistical fit outside the support of the data, and here we see why in dramatic fashion. Note that the same logic applies to interpolation. However, our goal of price optimization requires inter- and extra-polation, which by definition is based on assumptions and not upon the data. (ii) One can dismiss this simple example with the argument that no reasonable decision maker sets an infinite price or that the demand/revenue functions look obviously “wrong”, but again, these conclusions come from using economic structure to inform the ML and data, not the other way around. (iii) The lessons in this example are unrelated to statistical uncertainty. Different data would yield different fits, but the issues would persist, or perhaps manifest differently (except the forest, which always yields infinite prices, and thus has zero statistical uncertainty). (iv) Finally, it is worth noting that structural reasoning is commonly used in machine learning to improve prediction tasks. The structure of image recognition tasks is directly encoded into convolutional neural networks. The transformer architecture Vaswani-etal2017_NIPS is behind the recent success of large language models. In sum, structure at its core means constraints and restrictions, and this example shows that statistical structure and assumptions may not be appropriate or sufficient for economic decision making.
We now turn to our approach to enrich structural models with machine learning. We describe our structured deep neural network architecture, which bakes the model into the ML, and how second-step inference can be done using double machine learning. The prior section shows that ML is not suitable for learning structure, which is by definition the opposite of flexibility. Our goal here is to use ML for what it is good at, recovering complex heterogeneity, while retaining all the advantages of the structural model.
The starting point is a standard parametric structural model, described by
where the loss function $\ell(\by, \bt, \boldsymbol{\theta})$ encodes the researcher's economic restrictions on how the outcomes $\bY \in \mathbb{R}^{d_{\bY}}$ relate to the variables of interest $\bT \in \mathbb{R}^{d_{\bT}}$, depending on parameters $\boldsymbol{\theta} \in \bm{\Theta} \subset \mathbb{R}^{d_{\boldsymbol{\theta}}}$.\footnote{ {\it Notation.} Vectors and matrices will be written in boldface. Capital letters are used for population random variables; lower case for realizations. The expectation operator with respect to the true data generating process is denoted $\mathbb{E}[\cdot]$. True values use a superscript $\star$. The $L_2$ norm for a function $g(\bx)$ is $\| g \|_2 = \mathbb{E}[g(\bX)^2]^{1/2}$. } The “treatment” $\bT$ variables can be randomized or not and can be continuous, discrete, or mixed; the model can be causal or not. In the first step the structural parameters $\boldsymbol{\theta}$ are estimated from the data by solving the empirical analogue of (ref) over the appropriate parameter space $\bm{\Theta}$.
In a second step, inference is conducted on an object of the form
for a known function $\bH$, that depends on the parameters, covariates, and possibly some value of interest $\tilde{\bt}$ for the policy relevant variables. The function $\bH$ can be the parameters themselves, quantities such as marginal effects, elasticities, measures of surplus, and can encompass optimization and other such operations. For example, $\tilde{\bt}$ can be an optimal price, as in our empirical application in Section (ref). Technically $\tilde{\bt}$ can be subsumed into the definition of $\bH$, but it is expositionally useful to make explicit.
Other than restricting to per-observation losses and smooth functions (so that derivatives exist), the combination of Equations (ref) and (ref) encompass a wide variety of parametric models, including many M- and Z- estimation problems, such regression models, quasi/pseudo-likelihoods, or generalized estimating equations and accompanying second step objects like marginal effects, average elasticities, and other economic quantities Newey-McFadden1994_handbook,Ackerberg-Benkard-Berry-Pakes2007_handbook.
The positives of structural modeling are widely appreciated, and demonstrated above. The model incorporates theory-based restrictions and constraints. This means that the estimated parameters, or transformations thereof, are interpretable and directly useful useful in policy analysis, decision making, and the formation of counterfactuals. The two-step nature of the problem reflects exactly these types of analyses, where second step counterfactuals are obtained after estimating primitives of the model in the first stage. It also means that the data is used more efficiently, since structure implies restrictions, which will be crucial when embedding machine learning or nonparametrics.
The major drawback of Eqn.\! (ref) is rigidity: it does not allow for any heterogeneity in the relationship between $\bY$ and $\bT$. We want to allow for heterogeneity in a way that is flexible but maintains the economic structure. This could be for robustness, as results will be biased and subsequent decisions or analyses will be erroneous if heterogeneity exists but is neglected. This type of concern has been the focus of much recent research, particularly in program evaluation Chernozhukov-etal2018_generic,Wager-Athey2018_JASA,Chaisemartin-dHaultfoeuille2023_EJ. Further, as mentioned earlier, capturing and exploiting heterogeneity is key in modern targeting and personalization contexts, which is also an active area of research.
Our approach recasts the parameters $\boldsymbol{\theta}$ as parameter functions $\boldsymbol{\theta}(\bX)$ that are fully flexible in observed covariates $\bX \in \mathbb{R}^{d_{\bX}}$. That is, we assume the true first stage structural model is
for a function class $\cF$, which obeys standard restrictions (Assumption (ref) below). Equation (ref) is a specific, though quite general, formulation of nonparametric M-estimation Gallant-Nychka1987_Ecma. Crucially all the economic structure is maintained: whatever the interpretation of the parameter $\boldsymbol{\theta}$, the same holds for $\boldsymbol{\theta}^\star(\bx)$ for individuals of “type” $\bX = \bx$. These are not “nuisance” functions. The view, particularly common in the realm of inference after ML, is that first step functions are literally a nuisance, i.e. something annoying that must be dealt with, but are not interesting. We object to this view: in many applications the learned heterogeneity is actually the most interesting part, and because the $\boldsymbol{\theta}^\star(\bx)$ are interpretable functions in our framework, using them is straightforward.
The second step parameter of interest is correspondingly enriched, to be
To keep exposition simple we focus on the case of averages, i.e. where the parameter of interest is available in closed form. Replacing this step with parametric GMM is straightforward but notationally more cumbersome (see Remark (ref)). Our results may be useful for nonparametric inference as well (Remark (ref)). Equations (ref) and (ref) together define a broad class of two-step semiparametric settings, matching the generality of (ref) and (ref). Appendix (ref) shows some examples, both familiar and new. Finally, note that $\boldsymbol{\mu}^\star$ is defined using $\boldsymbol{\theta}^\star(\bX)$, but in some decision making cases this may not be appropriate, as discussed in Remark (ref).
To estimate the parameter function $\boldsymbol{\theta}^\star(\bx)$ we solve the empirical analogue of (ref) where minimization is over a class of structural deep neural networks, i.e. those with architecture shown in Figure (ref) as discussed above. We define
where $\cF_{\textsc{dnn}}$ is the class of deep neural networks that encodes not only the overall architecture but also tuning parameter choices of the width and depth of the network and the shape parameter given by the activation function. We focus on the standard fully connected feedforward neural network with ReLU activation for the hidden layers, but the same idea applies to other cases. To save space, we will not review deep learning basics here. Recent textbook treatments include: Goodfellow-Bengio-Courville2016_book and James-Witten-Hastie-Tibshirani2021_book for introductions and examples, Roberts-Yaida-Hanin2022_book for theory, and Keydana2023_book for implementation. Theorem (ref) in Section (ref) gives the convergence of these $\bm{\widehat{\theta}}(\cdot)$.
Our structural deep learning approach can be applied to any model/loss $\ell(\by, \bt, \boldsymbol{\theta}(\bx))$ and is easy to implement. Only a few lines of code need be changed relative standard neural network implementations to enforce the structural model and force the power of the network to learn the parameter functions rather than optimize the loss directly. This “structural compatibility” is one argument in favor of using deep neural networks for this modeling. There are several further reasons why neural networks are well suited to this task. (1) Perhaps most obviously, deep learning is a state of the art ML method and brings with it all the advantages: expressive power, the capacity for high dimensionality and flexible interactions, and moreover, the ability to use novel data such as images or text, which could be included in the definition of $\bX$. (2) From a practical point of view, neural networks can handle discrete covariates seamlessly without affecting the convergence rate nor the implementation. While in theory including discrete covariates does not impact the convergence rate for many nonparametric estimators, obtaining these estimates in practice typically requires special care and custom methods Racine-Li2004_JoE,Ma-Racine-Yang2015_JAE. (3) Deep learning is built on automatic differentiation, which allows us to obtain the necessary influence function computationally for free for any $\boldsymbol{\mu}^\star$ from (ref) based on any first step (ref) (see Section (ref)) making double machine learning conceptually straightforward to apply in any problem.
Of course, DNNs are not the only method that could be used to recover the parameter functions, nor do we claim any formal optimality property. The economic model holds globally, and we wish to match this in estimation, as it is important to learn counterfactual quantities in the second step, but other methods have the same property, including global series methods such as splines or polynomials and modern basis-function style methods including ridge regression and lasso.\footnote{The term “global” is slightly ambiguous, because methods like splines or partitioning are global smoothers and are structurally compatible, but use only data local to the evaluation point, more like a traditional kernel Cattaneo-Farrell2013_JoE,Cattaneo-Farrell-Feng2020_AoS.} All these estimators impose the structural model globally and in a computationally simple way. This may be one reason why series methods were often used in classic nonparametric M estimation (see Gallant-Nychka1987_Ecma for pioneering early work and Chen2007_handbook for further theory). Also Chen2007_handbook views neural networks as sieves for generic nonparametric M estimation, as do we. But these methods lack advantages (1), (2), and (3) from the prior paragraph. Classical methods often do not work for modern applications with more than several covariates. Selection methods require pre-specification of bases, including interaction effects.
Although it is not always as straightforward, it is possible to use “local” methods to learn the value of the parameter functions at a point, i.e. $\boldsymbol{\theta}^\star(\bx)$ for some $\bx$, and much recent work has been done in this area. Fan-Zhang2008_SII discuss kernels and local polynomials while Zeileis-Hothorn-Hornik2008_JCGS, Athey-Tibshirani-Wager2019_AoS, Nekipelov-Novosad-Ryan2019_WP, and Chatla-Shmueli2020_JCGS use trees and random forests; all share our goal of learning non-prediction function. Athey-Tibshirani-Wager2019_AoS and Foster-Syrgkanis2023_AoS are perhaps the most recent closest antecedents to our work, as both move ML away from prediction and both use orthogonal scores as a key ingredient. Athey-Tibshirani-Wager2019_AoS study random forests in a similar class of problems to (ref). Random forests also handle higher dimensional problems and flexible interactions, sharing advantage (1) above, and by their nature share advantage (2). As such, the forests of Athey-Tibshirani-Wager2019_AoS are probably the closest substitute for neural networks in our setting. The goal in that paper is inference on the nonparametric object $\boldsymbol{\theta}^\star(\bx)$ at a point $\bX = \bx$, which is different than our two-step problem. Influence functions based on ordinary derivatives are used there, though in the estimation step to aid with tree splitting, rather than for inference per se, as we do below. Foster-Syrgkanis2023_AoS are focused on risk minimization, as opposed to inference, but consider a similar class of models and use orthogonal scores to obtain improved properties. Their estimation target more closely resembles our two step problem, though a key innovation in their case is performing this in one step, rather than estimating the primitives and then studying different counterfactual questions. Their first and second step parameters can also be more general objects than ours in some ways.
Finally, other recent work has considered the combination of deep learning with structural models. Examples in different contexts include Norets2012_ER, Igami2020_EJ, Chen-Didisheim-Scheidegger2021_arXiv, Kaji-Manresa-Pouliot2023_Ecma, and Wei-Jiang2025_MktSci. Often, the goal is estimation of a parametric structural model and deep learning methods are applied to learn the mapping of data to parameters, which is quite different from our use of neural networks to enrich parameters for heterogeneity and personalization.
For second step inference on $\boldsymbol{\mu}^\star = \mathbb{E}[\bH(\bX, \boldsymbol{\theta}^\star(\bX), \tilde{\bt})]$, we apply and contribute to the recent semiparametric inference literature and in particular the now-common double machine learning (DML) method of Chernozhukov-etal2018_EJ. DML is a generic method for obtaining semiparametric inference that combines two ingredients: sample splitting and a Neyman orthogonal score. Asymptotic Normality then follows under weak conditions on first step estimators, which is particularly important for ML-based first steps, because relatively little is known of their mathematical and statistical properties. Typically, $L_2$ convergence rates are sufficient (along with mild regularity conditions). To save space, we defer to Chernozhukov-etal2018_EJ, Newey-Robins2018_WP, and Chernozhukov-etal2022_Ecma for complete discussion of the method and further references. As usual with DML, our results apply to any first-step estimator that has fast enough rates. However, an automatic differentiation engine may be convenient for computing the influence function when it is not known from prior work.
While sample splitting is straightforward both conceptually and in applications, orthogonal scores are not, and this is where our contribution lies. The key characterization of a Neyman orthogonal score is that is has a zero derivative with respect to the first stage parameters (see Section (ref)), which translates to less sensitivity to first step error. Though more general conceptually, Neyman orthogonal scores often come from influence functions where this zero derivative property is ensured. Knowing the influence function, or orthogonal score, is required for using DML, and this is often a hurdle in applications. For this reason many papers stick to known examples (e.g., average treatment effects or partially linear models), list references where scores are derived, or hand-derive new scores (typical examples are Belloni-Chernozhukov-Hansen2014_REStud, Farrell2015_arXiv, and Chernozhukov-etal2022_Ecma). We contribute to this inference method by showing that an influence function for $\boldsymbol{\mu}^\star$ is automatically available for any combination of $\ell(\cdot)$ and $\bH(\cdot)$ in Equations (ref) and (ref) provided their ordinary derivatives exist. We give the form of this influence function and discuss how it can be automatically computed in applications, even when it cannot be derived precisely or written down. This makes it easy to deploy in practice, because $\ell(\cdot)$ and $\bH(\cdot)$ are defined by the researcher, and the rest can proceed automatically, requiring only nonparametric regression. A key insight into applicability is that the orthogonal score need not be known as a function per se, we only require that its value be computable at each observation. Our goal and results here are closest to the series of work on “auto-DML” (Remark (ref)).
To state the influence function result, and thus estimation and inference for $\boldsymbol{\mu}^\star$, we define relevant derivatives, which may be known or found with automatic differentiation. Let $\bH_{\boldsymbol{\theta}}(\bx, \cdot; \tilde{\bt})$ be the $d_{\boldsymbol{\mu}} \times d_{\boldsymbol{\theta}}$ Jacobian of $\bH$ with respect to $\boldsymbol{\theta}$. Let $\bm{\ell}_{\boldsymbol{\theta}}(\by, \bt, \cdot)$ be the gradient of $\ell$ with respect to $\boldsymbol{\theta}$ and $\bm{\ell}_{\boldsymbol{\theta}\theta}(\by, \bt, \cdot)$ be the matrix of second derivatives. These are ordinary derivatives, not functional derivatives, and are thus computable automatically, even if they are evaluated at the value of the function $\boldsymbol{\theta}^\star(\bx)$.\footnote{To be precise, $\bm{\ell}_{\boldsymbol{\theta}}(\by, \bt, \boldsymbol{\theta}(\bx))$ is the $d_{\boldsymbol{\theta}}$-vector of first derivatives with respect to the parameter, evaluated at the number $\boldsymbol{\theta}(\bx)$, as in
The Jacobian $\bH_{\boldsymbol{\theta}}(\bx, \cdot; \tilde{\bt})$ is similar. Then $\bm{\ell}_{\boldsymbol{\theta}\boldsymbol{\theta}}(\by,\bt, \boldsymbol{\theta}(\bx))$ is the $d_{\boldsymbol{\theta}} \times d_{\boldsymbol{\theta}}$ matrix of second derivatives, with $\{k_1, k_2\}$ element given by
where $b_{k_1}$ and $b_{k_2}$ are the respective elements of the place-holder $\bb$. The use of standard differentiation in these contexts has been used in some prior work, though to our knowledge not paired with automatic differentiation to obtain feasible inference in such a broad set of models. One can obtain the influence function using functional derivatives and then evaluate these at the true function $\boldsymbol{\theta}^\star(\cdot)$, but our point is that one only needs the ordinary derivative evaluated at the number $\boldsymbol{\theta}^\star(\bx)$ (or the data points more specifically). } Then an influence function that applies to any combination of enriched model (ref) and parameter of interest (ref) is $\boldsymbol{\psi}(\by,\bt,\bx, \boldsymbol{\theta}, \boldsymbol{\Lambda}) - \boldsymbol{\mu}^\star$, with
where $\boldsymbol{\Lambda}(\bx) = \mathbb{E} [ \bm{\ell}_{\boldsymbol{\theta}\boldsymbol{\theta}}(\by,\bt, \boldsymbol{\theta}(\bx)) \mid \bX = \bx ]$ the population conditional Hessian of $\ell$, all evaluated at $\boldsymbol{\theta} = \boldsymbol{\theta}(\bx)$ and is the “other” nonparametric object that generally arises in the correction term. The (inverse) propensity score is perhaps the most familiar example, and our requirements on $\boldsymbol{\Lambda}(\bx)$ mirror that case exactly. Theorem (ref) below justifies this result and discusses it further. Influence functions are being used in a wide variety of contexts, and our derivation may be of independent interest (Remark (ref)).
To build intuition, it is useful to note that our result has precisely the same form as its parametric counterpart, but appropriately generalized. For the parametric two step inference problem of (ref) and (ref), the influence function is known to be $\bH\left(\bx, \boldsymbol{\theta}; \tilde{\bt}\right) - \bH_{\boldsymbol{\theta}}(\bx, \boldsymbol{\theta}; \tilde{\bt}) \boldsymbol{\Lambda}^{-1} \bm{\ell}_{\boldsymbol{\theta}}(\by, \bt, \boldsymbol{\theta})$, where $\boldsymbol{\Lambda} = \mathbb{E} [ \bm{\ell}_{\boldsymbol{\theta}\boldsymbol{\theta}}(\by, \bt, \boldsymbol{\theta})]$ Newey-McFadden1994_handbook. Equation (ref) is the same, and equally general, but enriched and hence conditional on $\bX = \bx$. This tight connection helps with implementation, because if the original structural model is understood by the researcher, so is the enriched version. For example, identification in the parametric case typically requires $\boldsymbol{\Lambda}^{-1}$ to exist, and in the enriched version this must hold for all “types” $\bx$. This is often a matter of assuming a positive conditional variance, rather than marginal variance. Appendix (ref) gives some examples and special cases.
Obtaining the estimate $\bm{\widehat{\mu}}$ and standard errors follows standard ideas of DML Chernozhukov-etal2018_EJ. The only wrinkle is that $\boldsymbol{\Lambda}(\bx)$ generally depends on $\boldsymbol{\theta}(\bx)$, and so three-way splitting is technically required. Note that throughout, particularly when paired with automatic differentiation, note that we do not need to known the functions $\bH_{\boldsymbol{\theta}}(\bx, \boldsymbol{\theta}(\bx); \tilde{\bt})$, $\bm{\ell}_{\boldsymbol{\theta}}(\by, \bt, \boldsymbol{\theta}(\bx))$, and $\bm{\ell}_{\boldsymbol{\theta}\boldsymbol{\theta}}(\by, \bt, \bm{\widehat{\theta}}(\bx))$; it suffices to know the values $\bH_{\boldsymbol{\theta}}(\bx_i, \bm{\widehat{\theta}}(\bx_i); \tilde{\bt})$, $\bm{\ell}_{\boldsymbol{\theta}}(\by_i, \bt_i, \bm{\widehat{\theta}}(\bx_i))$, and $\bm{\ell}_{\boldsymbol{\theta}\boldsymbol{\theta}}(\by_i, \bt_i, \bm{\widehat{\theta}}(\bx_i))$, which are readily available.
DML is now quite standard, so we keep the description brief. The data are divided into $K$ disjoint subsets, denoted $\mathcal{I}_k$, of equal size. Then
where $|\mathcal{I}_k|$ and $\bm{\widehat{\theta}}_{k}(\bx_i)$ and $\widehat{\boldsymbol{\Lambda}}_{k}(\bx_i)$ are obtained using observations in $\mathcal{I}_k^c$. If $\boldsymbol{\Lambda}(\bx)$ depends on $\boldsymbol{\theta}(\bx)$, then $\mathcal{I}_k^c$ is divided in two and $\bm{\widehat{\theta}}_{k}(\bx_i)$ and $\widehat{\boldsymbol{\Lambda}}_{k}(\bx_i)$ are obtained on separate samples. This further splitting is required in theory in general (see Remark (ref) and Appendix (ref) for common exceptions) but in practice may make no difference. Also, short stacking may yield improved performance Ahrens-Hansen-Schaffer-Wiemann2025_JAE. From the optimization of (ref), we can obtain the values $\bm{\ell}_{\boldsymbol{\theta}\boldsymbol{\theta}}(\by_i, \bt_i, \bm{\widehat{\theta}}(\bx_i))$ automatically. In other words, $\bm{\ell}_{\boldsymbol{\theta}\boldsymbol{\theta}}(\by_i, \bt_i, \bm{\widehat{\theta}}(\bx_i))$ is simply a column of data which we nonparametrically regress on $\bx_i$ to obtain $\widehat{\boldsymbol{\Lambda}}(\bx_i)$. This is identical to the more standard practice of obtaining the functional derivatives, characterizing the nonparametric object that is $\boldsymbol{\Lambda}(\bx)$, and then estimating it: we are not doing a numerical approximation. Numerical differentiation can be even simpler and faster, however. The same ideas apply to all other (potentially) unknown functions. Finally, the asymptotic variance $\boldsymbol{\Psi} = \mathbb{V}[\boldsymbol{\psi}(\bY,\bT,\bX, \boldsymbol{\theta}^\star, \boldsymbol{\Lambda})]$ can be consistently estimated by
Theorem (ref) validates this procedure. In theory, the size of each subset is proportional to $n$ and thus sample splitting does not impact convergence rates or precision, but in practice this can be a poor approximation. For classical kernel estimators, Velez2024_JMP proves that larger $K$ yields better results in an asymptotic framework with $K \to \infty$. For machine learning methods, this can be computationally costly, but we find in applications that large $K$ is more stable. With small $K$, the different $\bm{\widehat{\theta}}_k(\bx)$ can be quite different. Finally, sample splitting is not always needed, as shown by Farrell-Liang-Misra2021_Ecma for post-DNN average treatment effects (under essentially the same assumptions as here). It would be useful to extend that argument to more general models; see Chen-Syrgkanis-Austern2022_NIPS for relevant theory.
In this section we use our framework to replicate and extend Bertrand-etal2010_QJE. The data is from a large scale field experiment run on behalf of a financial institution in South Africa. Consumers were sent marketing material for short terms loans where a number of features of the advertising content and the interest rate offered were randomized (full details are left to that paper). For the purposes of our analysis we will focus on the interest rate offered as the treatment variable, and denote the scalar $T = R$. We will treat the characteristics of the advertising assigned to customers as covariates ($\bX_a$) rather than treatments. These assigned ad characteristics will be used along with a set of customer demographics ($\bX_d$) in our analysis. We collectively refer to these as $\bX=\{\bX_d,\bX_a\}$ and use them to calibrate our measures of heterogeneity in the analysis below. The key outcome variable ($Y$) is the indicator for whether or not the consumer applied for the loan. We use a binary choice model, one of the workhorse models in applied economics. Other relevant variables available in the data include an indicator of loan default ($D$) and the loan amount ($L$). While the full data set has $N=53,194$ individual observations, for the purposes of our illustration we will limit ourself to high-risk customers that form the bulk of the data. As such, $N=40,507$. Of these, only 2,371 have $Y=1$, which makes estimation more difficult.
In what follows, we conduct a series of analysis. First, we estimate a binary choice model of loan application allowing for heterogeneity in the parameter vector via our structured DNNs. We use these to compute the marginal effect of interest rate. We then use the results of the model (with some additional assumptions) to construct optimal personalized interest rate offers and compute the expected profits from implementing the personalization scheme.
Our setup adapts the framework outlined in Bertrand-etal2010_QJE and assumes that consumers have a utility \[ u = \theta^\star_1(\bx_d,\bx_a) + \theta^\star_2(\bx_d) r + \varepsilon, \] where $\boldsymbol{\theta}^\star(\bx) = (\theta^\star_1(\bx_d,\bx_a),\theta^\star_2(\bx_d))'$ are the vector of parameter functions and, (in our earlier notation) $\bT = R$. We further assume that $\varepsilon$ is Logistic distributed, which gives the standard Logit probabilities of response. Let $\br_1 = (1,r)'$. Then the response is assumed to be
where $G(u)$ is the logit function. This is exactly the enriched version of structural model (ref) used in Section (ref).
Using these probabilities we can construct the log-likelihood as
which is a heterogeneity enriched version of the standard workhorse binary choice model. The negative of this log-likelihood serves as the loss (ref) for our problem. One can easily verify the high-level assumptions in this setting, particularly given that the binary choice model is widely studied and well understood. For example, it is straightforward to show that $\boldsymbol{\Lambda}(\bx) = \mathbb{E}[G\left(\boldsymbol{\theta}^\star(\bx)'\bR_1 \right)(1-G\left(\boldsymbol{\theta}^\star(\bx)'\bR_1 \right)) \bR_1 \bR_1' \mid \bX \!=\! \bx]$, where $\bR_1 = (1, R)'$, and will be invertible under standard and commonly used economic assumptions. More discussion is given in Appendix (ref).
We implement Figure (ref) to maximize the likelihood with a simple network with two hidden layers of 10 nodes each. The simplicity of the network architecture is driven by the fact many dimensions of $\bX=\{\bX_d,\bX_a\}$ are binary, so there is less functional approximation required, and that we have a smallish dataset $\left(N=40,507\right)$. We use the Torch interface in {\sf R} (Keydana2023_book) to construct the computational graph and optimize the likelihood using the ADAM optimizer. For inference purposes we use 50-fold cross fitting, using all but one fold to estimate $\bm{\widehat{\theta}}(\bx)$ and the remaining fold to obtain $\bm{\widehat{\mu}}$.\footnote{Replication files are available at \url{https://github.com/maxhfarrell/FLM2}.}
We will use our estimated $\bm{\widehat{\theta}}(\bx)$ and novel influence function to explore two derived quantities, i.e. two different $\boldsymbol{\mu}^\star$ of (ref). First, we examine the marginal effect of the the focal treatment (interest rate offer). We note that our Logit specifications is slightly different from Bertrand-etal2010_QJE, who use a Probit specification. Second, we turn to a more ambitious goal of personalization and profit maximization, making more full use of the power of the framework. Additional examples include (i) the price elasticity at a price (here, interest rate) $\tilde{r}$, which sets $H = (1 - G\left( \theta_1 + \theta_2 \tilde{r} \right)) \theta_2 \tilde{r}$; (ii) a measure of willingness to pay obtained by taking $H = \theta_2 / \theta_1$; and (iii) expected consumer welfare, $H = - \log(1 + \exp(\theta_1 + \theta_2 \tilde{r})) / \theta_2 $. These are standard second-step objects of interest in choice models, and can be immediately used in our framework by evaluating each using the parameter functions $\boldsymbol{\theta}(\bx)$. Importantly, without our explicit use of a structural model, characterizing these quantities and obtaining inference would be difficult.
With our structure, the average marginal effect (AME) of any treatment can be written in closed form. Let $\tilde{r}$ be a given value of the interest rate (the treatment) and $\tilde{\br}_1 = (1,\tilde{r})'$. Then the parameter of interest is \[ \mathrm{AME}(\tilde{r}) = \mathbb{E} \left[ \left. \frac{\partial G(\boldsymbol{\theta}'\br_1 )}{\partial r} \right|_{\boldsymbol{\theta}^\star(\bX)'\tilde{\br}_1} \right] = \mathbb{E}\left[ G(\boldsymbol{\theta}^\star(\bX)'\tilde{\br}_1 )\left(1-G(\boldsymbol{\theta}^\star(\bX)'\tilde{\br}_1)\right) \theta^\star_2(\bX) \right]. \] We set $\tilde{r}$ to the sample average ($0.084$) for simplicity. From the data we obtain the point estimate $\widehat{\mathrm{AME}}(0.084) = -0.269$ using (ref), with corresponding $95\%$ confidence interval $(-0.399,-0.139)$ obtained from (ref). The original analysis in Bertrand-etal2010_QJE found a marginal effect of $-0.29$ (see Table III therein). Further, since we use a subset of the data, we refit a simple probit model on the subset and obtain a marginal effect of $-0.2505$. Both these estimates fall within our confidence interval, which we interpret as the original findings being robust to heterogeneity for this parameter.
We plot the distribution of the conditional average marginal effects along with their means and confidence intervals in Figure (ref). The lightest grey shows a kernel-smoothed density estimate. The shaded region is our 95% confidence interval, while the darkest shading shows the confidence interval one would obtain ignoring first step estimation (not using the influence function adjustment). The plot shows considerable heterogeneity uncovered by the DNNs. This shows that although the estimate of the average is robust to heterogeneity, there is considerable potential for personalization.
We now demonstrate how the estimated heterogeneity can be translated into personalized offers and the simplicity with which one can conduct inference on quantities of interest. We examine the mean of personalized interest rate offers and the expected profits from personalization. Note that it poses no issue that the corresponding $H$ functions are not available in closed form.
To construct profits we have to make some assumptions about the decision process of the firm and construct some auxiliary measures. First we will create a simple, parametric model for loan default probability. Given the rarity of defaults, the sample size is too small to uncover meaningful heterogeneity, and therefore we assume that the probability of default $D=1$ given an interest rate $R=r$ is also logistic: \[ \mathbb{P}[D \!=\! 1 \mid R \!=\! r] = \frac{1}{1+\exp\left(-\left[\delta^\star_1 + \delta^\star_2 r\right]\right)}. \] We estimate the parameters ($\delta^\star_1, \delta^\star_2$) from data and, for convenience in this illustration, take these parameters as given.\footnote{With richer data, one could apply the estimation and inference framework using a bivariate outcome of application and default, $\bY = (Y,D)'$ and enrich $(\delta^\star_1, \delta^\star_2)$ to include heterogeneity. Accounting for the estimation of $\delta^\star_1(\bx)$ and $\delta^\star_2(\bx)$ would be then automatic. With only 280 defaults observed, 0.7% of observations, this is not possible.}
To write the firm's expected profit for a given consumer, let $L$ be the loan amount, $M$ be the loan term ($=4$), and assume the outside option of the money being loaned is to obtain a rate of return $r_0$, we se set to 0.01 in the analysis. Since we focus on optimizing the interest rate for fixed values of the parameters, let $\mathbb{P}[Y \!=\! 1 \mid \bX \!=\! \bx, R \!=\! r] = P(r)$ and $\mathbb{P}[D \!=\! 1 \mid R \!=\! r] = D(r)$. Then profits are
Some discussion of this profit function is warranted. The profit function has two components - first the part where given a loan being initiated we have expected revenues. This expectation is computed by taking into account the revenue stream under non-default as well as the possibility of loss based on default (assuming no recovery of funds). The second component reflects the opportunity cost of the loan. We do not intend for this profit to be a perfect representation of reality but simply to illustrate the manner in which our methods can be applied realistic structural settings.
To find the optimal interest rate, we obtain the first order condition as per the usual optimization machinery. This yields \[ 0=\frac{d\Pi}{dr} = L \left[ \dot{P}(r) \left( M(1 - D(r)) r - D(r) - M r_0 \right) + P(r) \left( M(1 - D(r)) - M r \dot{D}(r) - \dot{D}(r) \right) \right], \] where $\dot{P}$ and $\dot{D}$ represent derivatives with respect to their scalar arguments. This profit function is smooth in $r$ but there exists the possibility that it is not uni-modal. Based on simulations we verified that, for parameters where $\dot{P}<0$ and $\dot{D}>0$ (as would be expected in this context) and for $r \in [0,r_\text{max}=0.25]$ the profit function is uni-modal and a unique $r^*$ obtains. To explore this we define a representation of the fixed point problem as
This is an implicit function which will show a unique fixed point $r_{\rm{opt}}$ if right hand side is decreasing in $r$. Figure (ref) presents a visual representation of Equation (ref). Each light grey curve corresponds to a distinct consumer profile $\bx_i$ and its intersection with the $y=x$ line represents the fixed point $r_{\rm{opt}}$ (the scale of the axes is different so $y=x$ is not at $45^o$). The density then represents the kernel density of the optimal personalized offers $r_{\rm{opt}}(\bx_i)$ across consumers. We note that while the fixed points are only shown for a subset of customers (to avoid clutter) the density is computed across the entire sample.
The reader should note that even though $r_{\rm{opt}}$ is not available in closed form it remains a smooth function of the parameters $\boldsymbol{\theta}$, which is all that is required for our method to apply. We can therefore provide inference for any statistic of the form (ref). As a simple example, Figure (ref) shows estimation and inference for $\mu^\star = \mathbb{E}[r_{\rm{opt}}(\boldsymbol{\theta}^\star(\bX))]$, the average of optimal offers. We obtain a point estimate of $14.12\%$, with a 95% confidence interval $[12.0\%, 16.23\%]$. This is shown in the figure, along with the plug-in interval as before.
Next we study expected profits from setting the optimal personalized interest rate, i.e., $\mathbb{E}[\Pi(r_{\rm{opt}}(\boldsymbol{\theta}^\star(\bX)))]$. From (ref), this is expressed as
We can apply our framework directly to this estimand, despite the complications (again, this is a smooth function $H$ but not expressible in closed form), using automatic or numerical differentiation. We can also appeal to the envelope theorem, which ensures that $\partial\Pi / \partial r\big|_{r=r_{\rm{opt}}}=0$. As such, the influence function for expected profits can be constructed in closed form (conditional on $r_{\rm{opt}}$, not $\boldsymbol{\theta}$). All three approaches yield nearly identical results.
We standardize the results (for plotting) and interpret the expected profit construct as the net expected income from offering a \$1 loan at a personalized interest rate to each potential customer. We find that $\widehat{\mu}=\$0.0497$ with a 95% confidence interval of $[\$0.0459,\$0.0535]$.
Figure (ref) depicts the density of profits across customers along with the estimate and confidence interval for the mean. Several features are notable here. First, we note that the estimate $\widehat{\mu}$, which includes the influence function adjustment, is outside the naive confidence interval based on the plug-in estimator. Statistically, this indicates that the bias correction from the influence function adjustment is large relative to the variance, that is, first stage noise from $\bm{\widehat{\theta}}(\bx)$ shifts the asymptotic distribution substantially, demonstrating the importance of double machine learning. The same phenomenon was shown in a partially linear model in Chernozhukov-etal2018_EJ and also appears in nonparametric bias correction contexts Cattaneo-Crump-Farrell-Feng2024_WP. See Remark (ref) for related discussion.
It is worth noting that the discrepancy between the estimates arise primarily on account of the curvature of the profit function. The gradient of the profit function is steep around the estimated parameter and perturbations therein result in large changes in the influence component. The shape of the profit density is driven by a complex interaction of various components - the distribution of marginal effects of interest rate (Figure (ref)), coupled with default propensities, the optimal prices, and the formulation of profits. Even with such complexity, the profits (and prices) are well behaved and economically meaningful. We caution the reader again that our application is an illustration and ignores a number of other factors that might have bearing on the firm's and consumers' decision problems.
In sum, this application showcases the simplicity with which (parametric) structural economic models can be enriched to incorporate nonparametric heterogeneity via deep neural networks, and how the results can be used directly for economic decision making and policy analysis based on personalization. While a full-fledged application would incorporate additional features and economic nuances, this proof of concept nonetheless showcases quite a difficult estimation and inference problem.
We first provide theoretical guarantees for the structural deep neural networks of Section (ref). Our theory generalizes Farrell-Liang-Misra2021_Ecma to the structural setting. We impose two assumptions. For the loss function, we require Lipschitz continuity in general and, near the truth, sufficient curvature. Neither are restrictive and both are common in the nonparametric M estimation literature (cf Chen2007_handbook and others, where further references and use of other norms are discussed). These conditions are for estimation of $\boldsymbol{\theta}^\star(\bx)$; further assumptions will be required for inference.
These requirements will often be implied by restrictions on the gradient and Hession of the loss, or on the matrix $\boldsymbol{\Lambda}(\bx)$. Such restrictions are natural in our setting, since they are commonly applied to parametric structural models; the same conditions readily transfer to the enriched setting. Differentiability is not required here and thus our results can be used in nonsmooth cases (for example Tambwekar-etal2022_IEEE and Padilla-Tansey-Chen2022_JMLR apply the theory of Farrell-Liang-Misra2021_Ecma to quantile regression and the same extension could be done here), however, differentiability will be required for inference later and may help in verification of these conditions.
The data generating process is assumed to obey the following conditions. Let $\bW = (\bY',\bT',\bX')'$ be the population random variables. Denote by $\bX_c$ the continuously distributed elements of $\bX$, with $d_c = \dim(\bX_c)$, and take the rest to be binary random variables, without loss of generality.
These are typical assumptions for nonparametric estimation and are similar to Farrell-Liang-Misra2021_Ecma. Part (iii) of this assumption restricts to smooth functions, which are known to be approximable by deep neural networks Yarotsky2017_NN,Yarotsky2018_WP,Hanin2017_WP.
We now state the main result for structural deep learning. We specialize this theorem to the standard implementation using deep and wide multi-layer perceptrons (fully connected, feedforward neural networks) and set the width and depth specifically for the fastest rate. Equation (ref) in Appendix (ref) shows a more general bound that is agnostic about the type of approximation, and hence the type of network. This can be used to obtain faster rates or cover fixed-width, very deep networks (see Section 2.3 of Farrell-Liang-Misra2021_Ecma for discussion).
The result of Theorem (ref) speaks directly to the nonparametric M estimation literature. This theorem takes deep learning away from prediction and toward learning economically meaningful parameters. It shows that deep nets enjoy the same properties of other nonparametric/ML methods, but with the advantages of structure. A theoretical drawback is that for a given smoothness level, this rate is not optimal. Obtaining the optimal rate, or studying different norms, would be a useful extension. The bounds are sharp enough for inference and reflects the excellent empirical performance.
We now turn to our influence function result. Influence functions have a long history in econometrics. Newey1994_Ecma remains the seminal treatment. We defer to that work and Ichimura-Newey2022_QE for background and the theory of influence functions, including regularity conditions for their existence. Our goal is not to contribute to the theory of influence functions per se, but rather to use the tools of this theory to obtain the methodological result of a broadly applicable influence function, to enable two-step semiparametric inference under weak conditions. Our main result is a calculation made possible by applying the ideas in these works, chiefly Newey1994_Ecma. That is, we view the influence function as a tool for obtaining feasible inference, rather than an object of interest in its own right (such as for studying efficiency). This viewpoint is implicit in recent work on inference after ML Belloni-Chernozhukov-Hansen2014_REStud,Farrell2015_arXiv,Chernozhukov-etal2018_EJ but it is worthwhile to make it explicit to better understand how this mode of thinking allows us to cover such a wide range of applications and apply automatic differentiation.
The assumption we impose next is mostly standard and ensures sufficient regularity for our influence function to be calculated and for asymptotic Normality of the resulting estimator. One conceptual point is that further assumptions will be needed for a causal interpretation, such as unconfoundedness or conditional exogeneity.
The most important assumptions here are that the first order condition of (ref) holds, $\boldsymbol{\theta}^\star(\bx)$ is identified, and that $\boldsymbol{\mu}^\star$ is pathwise differentiable. The latter keeps focus on regular semiparametric contexts. The former follows our idea to take a well-defined parametric model, for which such identification would hold, and enrich the model with machine learning. Conditional mean restrictions are a particularly popular case (see Appendix (ref)). Condition (iii) will often be implied by other conditions on the model, such as in the case of logistic regression if $\mathbb{P}[Y \!=\! 1 \mid \bX \!=\! \bx, \bT \!=\! \bt]$ is bounded away from zero and one (which in turn may be implied by conditions on $\bX$, $\bT$, and the functions $\boldsymbol{\theta}^\star$, such as boundedness). Or, in the context of treatment effects we need the standard overlap condition. Some version of the condition of positive variance, or invertibility of $\boldsymbol{\Lambda}(\bx)$, is quite standard in semiparametric problems.
The following result justifies our inference method. Other than the novel influence function, it is an application of existing DML theory Chernozhukov-etal2018_EJ. Let $\bm{0}_{d}$ be the $d$-long zero vector and $\bm{I}_{d}$ be the $d$-square identity matrix.
Here we impose the standard rate conditions on the first step estimators, allowing for valid inference after using any sufficiently accurate nonparametric/ML method. Deep learning remains a preferred choice in structural modeling, as discussed above. The assumptions used here intended to be simple and familiar, but are not minimal. The rate condition on $\boldsymbol{\Lambda}(\bx)$ can be weakened as shown by Chernozhukov-etal2022_Ecma. Cattaneo-Jansson-Ma2019_RESTUD show that in some problems computationally intensive procedures can be used to weaken first step assumptions. Further, our distributional approximation is first-order invariant to the first step estimator, as is typical, and this can be a poor finite sample approximation. More refined approximations, which account for the first step explicitly, have been obtained in simple cases Cattaneo-Crump-Jansson2014_ET_small,Cattaneo-Jansson-Newey2018_JASA,Cattaneo-Farrell-Jansson-Masini2024_WP but it is not clear if the same can be done here. Lastly, we note that similar debiasing correction terms appear for inference in high-dimensional models Belloni-Chernozhukov-Hansen2014_REStud,Javanmard-Montanari2014_JMLR,Zhang-Zhang2014_JRSSB and for loss functions directly Foster-Syrgkanis2023_AoS.
Structural modeling is a workhorse of empirical economic research. We have shown how to enrich these models with deep learning to capture rich heterogeneity, filling in the gaps left by economic theory. This method combines the strength of structural modeling and the strength of machine learning. We established convergence rates for structured deep learning and valid inference using a novel influence function calculation. Our method represents a step toward easier and more rigorous use of machine learning in economic research, but is far from complete. Shape restrictions are on major form of structure arising from economic theory (see Chetverikov-Santos-Shaikh2018_ARE for a recent review). Extending our methods to include impose shape constraints is an important step for future research. From an implementation point of view, there is also a lot of ground to cover for deep neural networks, including penalization and regularization, tuning parameter choices, and robust computation.
\singlespacing \begingroup \endgroup
\cleardoublepage