I am trying to evaluate a DeepNLME model where subject-level latent random effects are used directly as inputs to a neural network.
Construction
In a standard mixed-effects model, random effects (η) influence the model through predefined parametric relationships. In this approach I am trying to explore, the random effects are instead used as inputs to a small neural network. The network outputs subject-specific corrections to model parameters, while its weights are shared across all subjects.
The random effects remain fixed for each subject and are not time-varying. The network is evaluated once per subject before solving the differential equations, and all temporal behaviour is then governed by the dynamic model.
The motivation is to determine whether nonlinear relationships among subject-specific effects can be captured through the neural network, rather than relying solely on the covariance structure Ω.
Representative implementation:
model = @model begin
@param begin
tvCL ∈ RealDomain(lower = 1e-3)
tvVc ∈ RealDomain(lower = 1e-3)
tvkin1 ∈ RealDomain(lower = 1e-3)
tvkin2 ∈ RealDomain(lower = 1e-3)
tvkin3 ∈ RealDomain(lower = 1e-3)
tvkout1 ∈ RealDomain(lower = 1e-3)
tvkout2 ∈ RealDomain(lower = 1e-3)
tvkout3 ∈ RealDomain(lower = 1e-3)
tvEmax ∈ RealDomain(lower = 0.0, upper = 0.99)
tvEC501 ∈ RealDomain(lower = 1e-3)
tvEC502 ∈ RealDomain(lower = 1e-3)
tvEC503 ∈ RealDomain(lower = 1e-3)
nn_eta ∈ MLPDomain(2, 8, 8, 3; act = softplus, reg = L2(1e-5))
Omega ∈ PSDDomain(2)
sigma1 ∈ RealDomain(lower = 1e-3)
sigma2 ∈ RealDomain(lower = 1e-3)
sigma3 ∈ RealDomain(lower = 1e-3)
end
@random eta ~ MvNormal(Omega) # time-invariant, subject-level random effects
@pre begin
CLi = tvCL * exp(eta[1])
Emaxi = tvEmax * exp(eta[2])
# eta -> NN -> nonlinear, subject-specific correction to kin
# (evaluated once; time-invariant)
c1 = 0.40 * tvkin1 * tanh(nn_eta(eta[1], eta[2])[1])
c2 = 0.40 * tvkin2 * tanh(nn_eta(eta[1], eta[2])[2])
c3 = 0.40 * tvkin3 * tanh(nn_eta(eta[1], eta[2])[3])
end
@init begin
R1 = tvkin1 / tvkout1
R2 = tvkin2 / tvkout2
R3 = tvkin3 / tvkout3
end
@dynamics begin
Central' = -(CLi / tvVc) * Central
R1' = (tvkin1 + c1) *
(1 - Emaxi * (Central/tvVc) / (tvEC501 + Central/tvVc)) -
tvkout1 * R1
R2' = (tvkin2 + c2) *
(1 - Emaxi * (Central/tvVc) / (tvEC502 + Central/tvVc)) -
tvkout2 * R2
R3' = (tvkin3 + c3) *
(1 - Emaxi * (Central/tvVc) / (tvEC503 + Central/tvVc)) -
tvkout3 * R3
end
@derived begin
DV_R1 ~ @. Normal(R1, abs(R1) * sigma1)
DV_R2 ~ @. Normal(R2, abs(R2) * sigma2)
DV_R3 ~ @. Normal(R3, abs(R3) * sigma3)
end
end
From what I understand, this approach is broadly consistent with DeepNLME and related mixed-effects neural ODE frameworks. Random effects are treated as subject-level constants, which is standard in longitudinal mixed-effects models. What I am less certain about is the use of the inferred random effects themselves as neural-network inputs, and whether there are established references or identifiability considerations for this setting.
Questions:
-
Identifiability: Since both Ω and the neural network can explain between-subject variability, how can I determine whether they are learning distinct information rather than competing to explain the same signal? Are there recommended diagnostics for this?
-
Use of random effects as network inputs: In my model, the neural network takes inferred random effects (η) as inputs rather than observed covariates. Is this considered a statistically reasonable approach, and are there references that discuss similar constructions?
-
Time-invariant random effects: I treat the random effects as fixed for each subject and allow the dynamic model to account for changes over time. For longitudinal data, is this a reasonable assumption, or are there situations where time-varying random effects would be preferable?
-
Regularization: I have currently constrained the network output and apply L2 regularization to reduce overfitting. Are these generally sufficient, or are there better regularization strategies for embedded neural networks in mixed-effects models?
I would appreciate any feedback or pointers to relevant literature.