Why Match the Density Model to the Dose?
For a continuous treatment, a model must describe a density, not the probability of observing one exact dose. The fitted conditional density at a person's observed dose is the denominator contribution used in a continuous-treatment weight. Its value depends on the dose and covariate history, so a model that gives the wrong shape or support can assign implausible density to observed treatment values.
The Gaussian conditional density model is useful when its support and shape are reasonable. Here we consider two alternatives: the gamma distribution for strictly positive, unbounded doses, and the beta distribution for doses strictly between zero and one. The target is the fitted conditional density \( \hat f(A_{it}\mid H_{it}) \), evaluated at the observed dose \(A_{it}\) and history \(H_{it}\).
Gamma Regression for Positive Doses
Use the shape-and-mean parameterization \(A_{it}\mid H_{it}\sim \operatorname{Gamma}(k,\mu_{it}/k)\), where the second argument shown here is the scale. The density, conditional mean, and variance are
A common regression specification is \( \log(\mu_{it})=X_{it}^{\mathsf T}\beta \), with \(X_{it}\) a vector of functions of the history and \(\beta\) a coefficient vector. The logarithm ensures a positive fitted mean for every finite linear predictor. A constant shape \(k\) gives a variance proportional to the squared mean; it does not imply constant variance.
Suppose the conditional observations are modeled by this density and the design is treated as fixed. The log likelihood, omitting no parameter-dependent terms, is
For fixed \(k\), differentiate with respect to the linear predictor \( \eta_{it}=\log\mu_{it} \). Since \(d\mu_{it}/d\eta_{it}=\mu_{it}\), the derivative of the two terms involving \(\mu_{it}\) is \(-k+kA_{it}/\mu_{it}\). The score for \(\beta\) is therefore
If \(k\) is estimated too, maximize the likelihood over both mean-regression and shape parameters. In general, there is no simple closed-form joint fit. Numerical optimization must respect \(k>0\); common implementations use a log parameterization for \(k\). The score equation above is conditional on fixed \(k\), and should not be mistaken for the complete set of equations when shape is estimated.
Worked Example: A Gamma Density at an Observed Dose
Suppose a fitted gamma model has \( \log(\hat\mu_{it})=\log(2)+(\log 2)X_{it} \) and \( \hat k=2 \). For a history with \(X_{it}=1\), the fitted mean is \( \hat\mu_{it}=\exp(\log 2+\log 2)=4 \). Evaluate the fitted density at the observed dose \(A_{it}=3\).
Substitute \(k=2\), \(\mu=4\), and \(a=3\) in the gamma density. Because \(\Gamma(2)=1\), the coefficient is \(2^2/(1\cdot4^2)=1/4\). Thus \( \hat f(3\mid H_{it})=(1/4)(3)^{1}\exp(-2\cdot3/4)=(3/4)e^{-1.5}\approx0.16735 \).
This is a density value per unit of dose, not the probability that the dose equals exactly 3. Probabilities require integrating the density over an interval.
Beta Regression for Doses Between Zero and One
For a dose whose support is exactly the open interval \((0,1)\), parameterize a beta distribution by its mean \( \mu_{it} \) and precision \( \phi \). Its shape parameters are \( \alpha_{it}=\mu_{it}\phi \) and \( \beta_{it}=(1-\mu_{it})\phi \). The density and moments are
A standard regression uses \( \operatorname{logit}(\mu_{it})=X_{it}^{\mathsf T}\gamma \), where \( \operatorname{logit}(u)=\log\{u/(1-u)\} \). This maps every finite linear predictor to a mean strictly between zero and one. A simple model uses constant precision \(\phi\); other specifications can model precision as well, but the score below assumes it is constant.
For observations strictly inside the support, the log likelihood is
To derive the mean-regression score, write \( \eta_{it}=X_{it}^{\mathsf T}\gamma \). Then \(d\mu_{it}/d\eta_{it}=\mu_{it}(1-\mu_{it})\), \(d\alpha_{it}/d\eta_{it}=\phi\mu_{it}(1-\mu_{it})\), and \(d\beta_{it}/d\eta_{it}=-\phi\mu_{it}(1-\mu_{it})\). Let \( \psi(u)=d\log\Gamma(u)/du \), the digamma function. Since \( \log B(\alpha,\beta)=\log\Gamma(\alpha)+\log\Gamma(\beta)-\log\Gamma(\alpha+\beta) \), differentiating and using \(d\alpha+d\beta=0\) cancels the terms involving \( \psi(\alpha+\beta) \). Consequently,
In either model, fitting means maximizing the conditional likelihood under the chosen specification and checking that the optimization converged to an admissible solution. With repeated observations per person, a product of conditional densities can be used for point estimation under the stated treatment model; dependence across a person's observations still matters for uncertainty calculations.
Worked Example: A Beta Density at an Observed Dose
Suppose the fitted beta regression gives \( \hat\mu_{it}=0.4 \) for a particular history and \( \hat\phi=10 \). The fitted shape parameters are \( \hat\alpha_{it}=0.4(10)=4 \) and \( \hat\beta_{it}=0.6(10)=6 \). Evaluate the density at \(A_{it}=0.5\).
The beta normalizing constant is \(B(4,6)=\Gamma(4)\Gamma(6)/\Gamma(10)=6(120)/362880=1/504\). Therefore \( \hat f(0.5\mid H_{it})=504(0.5)^3(0.5)^5=504/256=1.96875 \).
A density greater than one is valid: density is not probability. For example, the probability of an interval is its integrated density and cannot exceed one.
Worked Example: Fitting an Intercept-Only Gamma Mean
Consider three positive observed doses \(2,4,6\), modeled independently with a common gamma mean \(\mu\) and fixed shape \(k=2\). The intercept-only model has \(X_{it}=1\) and \( \mu=\exp(\beta) \). Use the gamma score to estimate the mean, then evaluate the density at dose 2.
The score equation is \( \sum_j(A_j/\mu-1)=0 \), since \(k\) is nonzero. Thus \( (2+4+6)/\mu-3=0 \), giving \( \hat\mu=12/3=4 \) and \( \hat\beta=\log 4 \). The log likelihood as a function of \(\mu\), after dropping terms not involving \(\mu\), is \( -3k\log\mu-k(12)/\mu \). Its derivative is \( -3k/\mu+12k/\mu^2 \), which is zero at \(\mu=4\); its second derivative there is \( -3k/16<0 \), confirming a local maximum. Also, the derivative is positive for \(0<\mu<4\) and negative for \(\mu>4\), so this is the unique maximum over \(\mu>0\).
At the observed dose \(a=2\), \( \hat f(2)=\{2^2/\Gamma(2)4^2\}(2)^{1}\exp(-2\cdot2/4)=(1/4)(2)e^{-1}=0.5e^{-1}\approx0.18394 \).
Checking Support, Fit, and Interpretation
A well-defined maximum-likelihood fit does not establish that the conditional density is adequate. Inspect observed and fitted dose distributions across important histories, compare fitted means and spread with the data, and examine whether observed doses receive extremely small fitted densities. In a longitudinal weighting analysis, very small denominator densities can produce large weights. This is a warning about the fitted treatment mechanism and resulting weights, not proof that any one modeling choice is correct.
- Check the support first. A gamma model assigns density only to positive values; a beta model assigns density only to values strictly between zero and one. Observations outside these supports cannot be evaluated under the model.
- Check boundaries and masses. Standard beta likelihoods require every dose to be strictly between zero and one. Exact zeros or ones, including values created by rounding or censoring, are not ordinary beta observations. A model with an explicit boundary component may be needed; adding an arbitrary small constant changes the data and does not solve the modeling problem.
- Check the variance pattern. Gamma constant-shape models impose \( \operatorname{Var}(A\mid H)=\mu^2/k \); beta constant-precision models impose \( \operatorname{Var}(A\mid H)=\mu(1-\mu)/(\phi+1) \). Strong departures from these patterns can lead to poor density estimates even if the mean regression looks plausible.
- Check estimated parameters and computation. Nonconvergence, estimates driven toward support boundaries, or large changes under reasonable initial values may indicate weak information, separation-like behavior, or a misspecified model. Inspect the fitted density at the actual observed doses, not only coefficient estimates.
The Gaussian model has support on the whole real line and may be reasonable for approximately symmetric doses with little probability near zero or other boundaries. The gamma model respects positive support and accommodates right skew, but its mean-variance relationship can be restrictive. The beta model respects the unit interval and permits a range of shapes, but excludes exact boundary values. Kernel estimation is a flexible alternative that does not impose these parametric shapes, but it introduces smoothing choices; it is a separate approach rather than a reason to ignore the support of the dose.
These parametric models have limitations. A conditional density can be sensitive to omitted history terms, incorrect functional forms, and a restrictive constant-shape or constant-precision assumption. A density value also depends on the measurement scale: its units are inverse dose units, and a value is not directly comparable across differently scaled treatments without accounting for that scale. In practice, use a specification compatible with the treatment's support, evaluate its fitted densities at observed values, and assess the consequences of model inadequacy for the weights.
Check Your Understanding
Answer each question, then compare with the solutions below.
- A gamma model has shape \(k=3\) and fitted mean \(6\). What is its conditional variance?
- A beta model has fitted mean \(0.25\) and precision \(7\). What are its two shape parameters?
- Why is a fitted density of \(1.97\) not an invalid probability?
- Can a standard beta likelihood directly evaluate a dose recorded as exactly \(1\)? What is the modeling issue?
Solutions. (1) The gamma variance is \( \mu^2/k=6^2/3=12 \). (2) The shapes are \( \alpha=0.25(7)=1.75 \) and \( \beta=(1-0.25)(7)=5.25 \). (3) A density is probability per unit of dose; only its integral over a set is a probability, so its value may exceed one. (4) No. The standard beta density is defined on \(0<a<1\), and its likelihood requires an interior observation. A boundary value needs a defensible model for how it arose, rather than direct substitution or an arbitrary adjustment.