When modeling a variable constrained between minimum and maximum values, standard linear models are inappropriate because they assume the response variable can take any value on the real line. Let me walk through the proper Bayesian approach for bounded data.
Why Linear Models Fail for Bounded Data
A standard linear model assumes:
y = β₀ + β₁x₁ + β₂x₂ + ... + ε
where ε ~ Normal(0, σ²)
This implies that y can theoretically take any value from -∞ to +∞. For bounded data (say y ∈ [a, b]), this creates several problems:
- Predictions outside bounds: The model can predict values below the minimum or above the maximum
- Incorrect uncertainty quantification: The normal error assumption implies symmetric uncertainty, which is unrealistic near boundaries
- Heteroscedasticity: Variance typically decreases as values approach bounds
Appropriate Likelihood Functions
Beta Distribution (for data in [0,1])
The Beta distribution is ideal for data naturally bounded in [0,1]:
y ~ Beta(μφ, (1-μ)φ)
where:
- μ is the mean (linked to predictors)
- φ is a precision parameter
For arbitrary bounds [a, b], transform the data:
y_transformed = (y - a)/(b - a)
Beta Regression Model
The mean μ is modeled using a link function (typically logit):
logit(μᵢ) = β₀ + β₁x₁ᵢ + β₂x₂ᵢ + ...
This ensures μ stays in (0,1).
Alternative: Truncated Normal
For data that would be normally distributed if not for bounds:
y ~ TruncatedNormal(μ, σ², lower=a, upper=b)
where μ is modeled linearly:
μᵢ = β₀ + β₁x₁ᵢ + β₂x₂ᵢ + ...
Other Options
- Scaled and shifted Beta: For general [a,b] bounds without transformation
- Truncated Student-t: For heavy-tailed bounded data
- Logit-normal: For (0,1) bounded data with specific properties
Appropriate Prior Distributions
For Beta Regression
Regression coefficients (β):
β ~ Normal(0, τ²)
where τ² represents prior variance (often set to 10 or 100 for weak informativeness)
Precision parameter (φ):
φ ~ Gamma(α, β)
Common choices: Gamma(0.01, 0.01) for weak prior, or Gamma(2, 0.1) for mild regularization
For Truncated Normal
Regression coefficients (β):
β ~ Normal(0, τ²)
Standard deviation (σ):
σ ~ Half-Cauchy(0, scale)
or
σ ~ Exponential(λ)
Complete Example: Beta Regression
For data bounded in [L, U], here's a complete specification:
Data transformation:
z = (y - L)/(U - L)
Likelihood:
zᵢ ~ Beta(aᵢ, bᵢ)
where:
aᵢ = μᵢ × φ
bᵢ = (1 - μᵢ) × φ
logit(μᵢ) = β₀ + β₁x₁ᵢ + β₂x₂ᵢ + ...
Priors:
β₀, β₁, β₂, ... ~ Normal(0, 10)
φ ~ Gamma(2, 0.1)
Implementation Considerations
-
Parameter interpretation: In beta regression, coefficients represent effects on the logit scale, not the original scale
-
Predictions: Must back-transform:
ŷ = L + (U - L) × logit⁻¹(x'β)
-
Model checking: Verify residuals respect bounds and check for patterns near boundaries
-
Variance modeling: Can extend to model both mean and precision as functions of predictors
This approach properly accounts for the bounded nature of the response, provides valid uncertainty quantification near boundaries, and ensures all predictions respect the constraints. The choice between Beta regression and truncated distributions depends on whether the bounding is intrinsic to the data-generating process or imposed externally.