5 ms·
By looking at the user's guide, it seem that Stan has also other use cases than Bayesian inference. Examples are linear regression, mixture models and even ODEs
by pvitz 6y ago
By looking at the user's guide, it seem that Stan has also other use cases than Bayesian inference. Examples are linear regression, mixture models and even ODEs. Does anybody here have experience with Stan and R and could comment on the strengths of Stan in non-Bayesian contexts?
- Crye 6y agoI don't know what your experience with Bayesian modeling is, and I'll admit mine is limited, but STAN can solve linear regression by defining up a linear model and then setting the dimension parameters as a normal distribution to solve. This is great because it gives you a measure of certainty for each of your parameters.
- elsherbini 6y agoStan uses MCMC (specifically NUTS, which is a Hamiltonian Monte Carlo sampler) to optimize parameter fitting, so it can be used for things like ODEs. Here is an example from a class taught last January that uses stan to fit a simple ODE (using the `integrate_ode_rk45` function in stan): https://github.com/gregbritten/BayesianEcosystems_IAP/blob/master/notebooks/npzF_stan_pred.ipynb https://github.com/gregbritten/BayesianEcosystems_IAP/blob/m...
- currymj 6y agoI believe the main reason for including ODE solvers is basically to do Bayesian parameter estimation of ODEs from data. likewise as far as I know, linear regression and mixture models are both done in a Bayesian style (a hierarchical model giving priors for parameters).
- standevbob 6y agoStan provides both frequentist inference (penalized maximum likelihood with bootstrapped confidence intervals) and Bayesian inference (MCMC sampling or approximate variational) inference. As currymj says, the differential equations (same for all the linear algebra solvers like eigendecomposition) can be used in defining likelihoods for either Bayesian or frequentist estimation. Same for all of our linear algebra operations and special functions. Not every model that can be programmed in Stan has a well-defined MLE or proper posterior. Standard hierarchical/multilevel models don't have MLEs, even with standard shrinkage. Bayesian models with improper priors and no data wind up with improper posteriors, etc. Having said all that, almost all of the use of Stan is for Bayesian inference.
- nlpNick 6y agoYou may find the `rstanarm` package interesting/useful. I've used it for linear regression and HLMs. https://mc-stan.org/rstanarm/articles/index.html https://mc-stan.org/rstanarm/articles/index.html
- ChrisRackauckas 6y agoDiffEqBayes.jl can transpile Julia ODE code to Stan. This is a nice interface to use Stan directly from Julia, and also makes it easy to benchmark the ODE inference in a bunch of PPLs. Some benchmarks: https://benchmarks.sciml.ai/html/ParameterEstimation/DiffEqBayesLotkaVolterra.html https://benchmarks.sciml.ai/html/ParameterEstimation/DiffEqB... https://benchmarks.sciml.ai/html/ParameterEstimation/DiffEqBayesFitzHughNagumo.html https://benchmarks.sciml.ai/html/ParameterEstimation/DiffEqB...