# Porting multi-level regression with poststratification (MRP) tutorial from rstanarm

**URL:** https://discourse.julialang.org/t/porting-multi-level-regression-with-poststratification-mrp-tutorial-from-rstanarm/96689
**Category:** Probabilistic Programming
**Tags:** turing
**Created:** [March 28, 2023, 1:05am UTC](https://discourse.julialang.org/t/porting-multi-level-regression-with-poststratification-mrp-tutorial-from-rstanarm/96689 "2023-03-28T01:05:10Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![p-gw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/p-gw/32/210518_2.png) [@p-gw](https://discourse.julialang.org/u/p-gw)
#### Post date: [March 28, 2023, 10:48am UTC](https://discourse.julialang.org/t/porting-multi-level-regression-with-poststratification-mrp-tutorial-from-rstanarm/96689/2 "2023-03-28T10:48:13Z")

</div>

One immediate improvement is to change the AD backend in Turing to use ReverseDiff.jl instead of ForwardDiff.jl (the default)

```julia
using Turing, ReverseDiff

Turing.setadbackend(:reversediff)
Turing.setrdcache(true)

```

See also [Automatic Differentiation](https://turinglang.org/v0.24/docs/using-turing/autodiff)

In my experience Turing will still be slower than Stan for these types of models where the number of parameters is large.

We had some discussions in the past which might also be helpful to you:

- [Making Turing Fast with large numbers of parameters?](https://discourse.julialang.org/t/making-turing-fast-with-large-numbers-of-parameters/69072)
- [Improving performance of item response model in Turing.jl](https://discourse.julialang.org/t/improving-performance-of-item-response-model-in-turing-jl/86249)

---

_[View the full topic](https://discourse.julialang.org/t/porting-multi-level-regression-with-poststratification-mrp-tutorial-from-rstanarm/96689)._
