Predicting the relationship between religiosity and social conservatism

Analysing 2.3 million survey responses lends insight into how religious beliefs can influence views on justice, sexual freedom, and moral reasoning.

Research background

Religious beliefs can shape human behaviour and social attitudes in profound ways. In the Department of Psychology at Waipapa Taumata Rau University of Auckland, Research Fellow Guy Lavender Forsyth studies how the effects of religious beliefs differ across religious traditions, influencing political orientation and views on justice to sexual freedom and moral reasoning.

To explore these questions, Guy is analysing 2.3 million survey responses drawn from the World Values Survey Association. To uncover insights faster, he is leveraging large-scale Bayesian computational methods and running Markov Chain Monte Carlo (MCMC) simulations.

This ambitious analysis is run on the REANNZ High-Performance Computing (HPC) cluster, Mahuika, allowing Guy to probe patterns and relationships within the data at a scale and depth that would be impossible with conventional statistical approaches.

research figure plotting conservatism on issues

Figure 1. Probabilistic effect of importance of religion as a function of 32 social conservatism predictors. Marginal distributions based on Markov Chain Monte Carlo estimates.

 

Project challenges

Guy came to REANNZ seeking help with his model. It was taking more than 10 days to run and he wasn't sure if that was because of the size of the problem or due to inefficient code.

What was done

Research Software Engineers from REANNZ profiled the code and found it running at over 90% efficiency, indicating the bottleneck was computational rather than memory-bound.

An attempt to port the code to Mahuika's Graphical Processing Unit (GPU) resources yielded no appreciable improvement, as the categorical nature of the survey data, essentially binary checkbox responses, is poorly suited to GPU acceleration.

Instead, the team recompiled Stan, the probabilistic programming language used to generate the Markov chains, to leverage MPI (Message Passing Interface), a parallelisation framework commonly used on high-performance computing clusters. With MPI, each Markov chain was allocated 30 cores, reducing runtimes for the most complex simulations to a matter of days.

Profiling indicated the code was running optimally, so the engineers turned their attention to the algorithm itself. Guy had implemented his Markov chain simulations using the No-U-Turn Sampler (NUTS; Hoffman & Gelman 2011, arXiv:1111.4246) in Stan, which automatically tunes the sampler's trajectory to efficiently explore complex posterior distributions.

graph showing No-UTurn

Figure 2. Example trajectory of the No U-Turn Sampler, from Hoffman, Matthew D. and Andrew Gelman. “The No-U-turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.” J. Mach. Learn. Res. 15 (2011): 1593-1623.

The key tuning parameter, adapt_delta, controls the target acceptance rate for proposed steps — values closer to 1 force the sampler to take smaller, more cautious steps through the parameter space, reducing the risk of divergent transitions at the cost of longer computation time.

Reducing adapt_delta from 0.99 to 0.80 allowed the sampler to take larger steps through the posterior, yielding a 40% improvement in convergence rate and a threefold reduction in model runtime.

Main outcomes

Together, these optimisations proved transformative: leveraging MPI provided the compute capacity needed for complex simulations, while relaxing the posterior step size via adapt_delta significantly accelerated both convergence and overall runtime.

Critically, the analysis also disentangled the contributions of model efficiency and model complexity to runtime — an important distinction for guiding future work.

Researcher feedback

“I'd definitely recommend a REANNZ consultancy to others. It is a wonderful initiative.”

- Guy Lavender Forsyth, Department of Psychology, University of Auckland

 


 

This case study shares some of the technical details and outcomes provided through our Consultancy Service. This service supports projects across a range of domains, with an aim to lift researchers’ productivity, efficiency, and skills in research computing. Get in touch to discuss how our Research Software Engineers and specialist support could help advance your project.

Find anything about our products, services, and more. Enter a query in the search input above.