Is it possible to include integral transformation of a variable in Bayesian hierarchical models? I am tackling a problem, which might be described by the following analogy:
Suppose we have N similar cars riding on the road, and their speed depends on several factors: proportion of chemicals in gasoline (continuous variable), whether a car has a powerful engine (categorical), and the quality of the part of the road that the car rides on a given moment (might be continuous or discrete).
We have some estimates of how exactly these factors influence speed from engineers/experts, so we want to include this prior knowledge of coefficients by running a Bayesian inference rather than just fitting a regression as is.
The problem is that to fit any kind of model, we have to have both independent variables and targets, but we do not have any data for the speed of cars - instead we only know the total distance these cars traveled on the road. This means that the only target variable we can train our model with has to be derived from speed as some integral of speed over time and road quality (for these we also have the data).
My question is: does Bayesian inference somehow allow for this integral kind of variable/distribution transformation in hierarchical modeling? It gives us the power to transform variables by exponentiating them or passing them as parameters to other distributions, but I have no idea about integrals.
If it is possible (maybe with some other method than BI), I would also like to know how to evaluate this proxied speed formula, and/or use some potential scarce data about these speeds (from limited experiments) to train the general model.
Thank you in advance!

Yes, if you can write down the integral, then this is possible. You'll almost certainly end up using some MCMC sampler and the details depend on the sampler. You basically need to somehow calculate the parameters of the likelihood function for what you observe from the underlying parameters your interested in and that can involve integrals (or differential equations etc.).
With "traditional" (e.g. Metropolis-Hastings type) samplers, you just need a function that evaluates the integral to plug that in (some MCMC samplers such as PROC MCMC in SAS have numeric integration by quadrature available and that's not too crazy to manually implement, either), while with modern Hamiltonian Monte Carlo samplers you'll also need derivatives of the integral (or express it so that auto-differentiation can obtain this for you). E.g. Stan (which you can use in R via the rstan package or in some situations via the simpler brms, in python via pystan etc.) has ready made capabilities for 1d-integrals, while for more complex integrals some more thinking/re-expressing as differential equations (for which there are then various differential equation solvers available). You might also be able to sample from the integral without having to numerically solve it. Of course, these tend to be time consuming steps, so 1) make sure you cannot analytically solve the integral and 2) if you have computers or servers with lots of CPUs, then use the parallelization capabilities of tools like Stan.
