Hierarchical Modelling of Species Communities (HMSC) is a model-based approach for analyzing community ecological data (Ovaskainen et a. 2017a). The obligatory data for HMSC-analyses includes a matrix of species occurrences or abundances and a matrix of environmental covariates. Additional and optional data include information about species traits and phylogenetic relationships, and information about the spatiotemporal context of the sampling design. HMSC partitions variation in species occurrences to components that relate to environmental filtering, species interactions, and random processes. HMSC yields inference both at species and community levels. It can be used to generate simulated communities under given environmental conditions, and thus its predictions can be compared to independent validation data, and it can be used for scenario simulations. 


Hierarchical Modelling of Species Communities


The current version of the R-package Hmsc is found on CRAN. For a description of the software, see

The development version is found on Github.

The old matlab and R versions of HMSC can be found here.

HMSC book

The first copies of the book now exist, fresh from the printing press!

The official publication date (for both the printed book and the ebook) for the UK and Europe has been set as 11th June 2020.   Further global publication dates will depend on shipping schedules and will be available on

Click here to order from the publisher's site - use offer code JSDM2020 to get 20% off.

Click above to buy HMSC book at 20 percent discount with code JSDM2020

Executable scripts

As supporting information to the book, we provide here R-scripts and data files for the three real data examples of the book: the plant example of Section 6.7, the fungal example of Section 7.9, and the bird example of Section 11.1. The scripts were originally developed by Otso Ovaskainen and Nerea Abrego, and Jari Oksanen has made further improvements to them.


Forthcoming HMSC courses

Australia, Sydney. Two-day course 18-19 June 2020. This course will be organized just before the International Statistical Ecology Conference (ISEC) as a short course at UNSW Sydney. Teachers Otso Ovaskainen, Jari Oksanen, and possibly others. More information on this course coming soon. Note also the short course "Multivariate modelling in ecology and joint species distribution models" on Saturday 20th June and the 90 min HMSC tutorial on Monday 22nd June. UPDATE: Due to the COVID-19 pandemic, the short course and HMSC tutorial will take place virtually, and the two-day course is cancelled.

USA, Salt Lake City. One-day course 2nd August 2020. This course will be organized as a workshop of the Ecological Society of America (ESA) meeting. Teachers Otso Ovaskainen, Jari Oksanen, and possibly others. For more information, see UPDATE: Due to the COVID-19 pandemic, the Salt Lake City course has unfortunately been CANCELLED.

Europe, Finland, Helsinki, and online. Five-day-course 2-6 November. Teachers Otso Ovaskainen, Nerea Abrego, Jari Oksanen, and others: Hierarchical Modelling of Species Communities with the R-package Hmsc:

  • Course Overview: This course is aimed for students and researchers who are interested in analysing data on community ecology in a way that allows placing their results in the context of modern theory. The course covers a comprehensive treatment of HMSC, including both the technical detail of the statistical methods, as well as the ecological interpretation of the results. With the help of worked out examples, the participants learn how to conduct and interpret statistical analyses in practice with the R-package Hmsc, providing a fast starting point for applying HMSC to their own data. The participants are encouraged to bring also their own data so that they can get hands-on support on HMSC-analyses of their own projects. Ideally, you will come back from the course with R-scripts that run the entire Hmsc pipeline from constructing and fitting the models to producing the result tables and figures, as well as draft texts for how the analyses were done (for the Material and Methods section for your manuscript) and what the results are (for the Results section of your manuscript).
  • Course Outline:
    • Introduction and motivation
    • How does HMSC relate to ecological theory?
    • The syntax and typical workflow of the R-package Hmsc
    • Types of data that can be incorporated to Hmsc
    • Types of questions that can be addressed by Hmsc
    • Worked out case studies on plants, fungi and birds
    • Break-out groups to analyse your own data
    • How to describe the HMSC analyses in the “Material and Methods” section of your manuscript?
    • How to report the results of the HMSC analyses in the “Results” section of your manuscript?
  • Prerequisites: You will need to bring your own laptop to the workshop, with preferably both R and the R-package Hmsc (found on CRAN) installed. The course will closely follow the book (Ovaskainen & Abrego 2020), and thus we recommend that you familiarize yourself with the book prior to the course.
  • Duration: 10.00 am to 4.00 pm all five days. Lunch break 12-13.
  • The course is free of charge (no travel or accommodation provided)
  • You can attend in person or follow online
  • Register here. Participants will be prioritized according to registration order and relevance.
  • UPDATE 10th August 2020. We have currently 160 registered participants (either online or in site), the number still steadily increasing. We are excited that so many researchers are interested in taking this course! We have decided not to restrict the number of participants, but to organize the teaching so that we can accommodate all who wish to take part.
    • The main challenge will be that we wish to provide one-on-one guidance on how to analyze your own data, for those participants who plan to come with their own data. As the main tool to achieve this, we will check already before the course that your data are technically ready for HMSC-analyses, including fitting a pilot HMSC-model to your data. This will ensure that during the course we can focus on the actual science, rather than wondering e.g. why a specific error message appears.
    • Thus, if you wish for support with analyzing your own data with HMSC, send your data after registering! As the first step, read carefully through INSTRUCTIONS.txt (found from the zip-file below) which explains in which format and where you should send your data. The other files in the zip-folder are templates that you should follow when preparing your own data. We will start setting up the pilot HMSC-models in the order that we receive the data, so even if there is no deadline of when you should send your data, we recommend you to send it as soon as possible to ensure that we will have the time to process it before the course.
    • If you have any questions, email to hmsc-course (at) with email subject "question_surname_firstname", as explained in more detail in INSTRUCTIONS.txt.




Core papers about HMSC

Ovaskainen, O., Tikhonov, G., Norberg, A., Blanchet, F. G., Duan, L., Dunson, D., Roslin, T. and Abrego, N. 2017a. How to make more out of community data? A conceptual framework and its implementation as models and software. Ecology Letters 20, 561-576.


Ovaskainen, O., Tikhonov, G., Dunson, D., Grøtan, V., Engen, S., Sæther, B.-E. and Abrego, N. 2017b. How are species interactions structured in species rich communities? A new method for analysing time-series data. Proceedings of the Royal Society B: Biological Sciences, 284, 20170768.


Tikhonov, G., Abrego, N., Dunson, D. and Ovaskainen, O. 2017. Using joint species distribution models for evaluating how species-to-species associations depend on the environmental context. Methods in Ecology and Evolution 8, 443-452.


Tikhonov, G., Opedal, Ø. H., Abrego, N., Lehikoinen, A., de Jonge, M. M., Oksanen, J. and Ovaskainen, O. 2020a. Joint species distribution modelling with the R-package Hmsc. Methods in Ecology and Evolution, in early view,


Tikhonov, G., Duan, L., Abrego, N., Newell, G., White, M., Dunson, D. and Ovaskainen, O. 2020b. Computationally efficient joint species distribution modelling of big spatial data. Ecology, e02929.


Ovaskainen, O. and Abrego, N. 2020. Joint Species Distribution Modelling – With Applications in R. Cambridge University Press, in press.

Abrego, N., Norberg, A. and Ovaskainen, O. 2017. Measuring and predicting the influence of traits on the assembly processes of wood-inhabiting fungi. Journal of Ecology 105, 1070-1081.


Ovaskainen, O., Roy, D., Fox, R. and Anderson, B. 2016. Uncovering hidden spatial structure in species communities with spatially explicit joint species distribution models. Methods in Ecology and Evolution 7, 428-436.


Ovaskainen, O., Abrego, N., Halme, P. and Dunson, D. 2016. Using latent variable models to identify large networks of species-to-species associations at different spatial scales. Methods in Ecology and Evolution 7, 549-555.


A review of joint species distribution modelling:

Warton, D., Blanchet, G., O’Hara, R., Ovaskainen, O., Taskinen, S., Walker, S. and Hui, F. K. C. 2015. So many variables: joint modelling in community ecology. Trends in Ecology and Evolution 30, 766-779.


How HMSC results link to the underlying community assembly processes:

Ovaskainen, O., Rybicki, J. and Abrego, N. 2019. What can observational data reveal about metacommunity processes? Ecography 42, 1877-1886.


The predictive performance of HMSC in comparison to other SDM methods:

Norberg, A., Abrego, N., Blanchet, F. G., Adler, F., Anderson, B., Anttila, J., Araújo, M., Dallas, T., Dunson, D., Elith, J., Foster, S., Fox, R., Franklin, J., Godsoe, W., Guisan, A., O'Hara, B., Hill, N., Holt, R. D., Hui,  F., Husby, M., Kålås, J., Lehikoinen, A., Luoto, M., Mod, H., Newell, G., Renner, I., Roslin, T., Soininen, J., Thuiller, W., Vanhatalo, J., Warton, D., White, M., Zimmermann, N., Gravel, D. and Ovaskainen, O. 2019. A comprehensive evaluation of predictive performance of 33 species distribution models at species and community levels. Ecological Monographs 89, e01370.


Some empirically oriented papers applying HMSC:

Norberg, A., Halme, P., Kotiaho, J. S., Toivanen, T. and Ovaskainen, O. 2019. Experimentally induced community assembly of polypores reveals the importance of both environmental filtering and assembly history. Fungal Ecology 41, 137-146.

Minard, G., Tikhonov, G., Ovaskainen, O. and Saastamoinen, M. 2019. The microbiome of the Melitaea cinxia butterfly shows marked variation but is only little explained by the traits of the butterfly or its hostplant. Environmental Microbiology 21, 4253-4269.

Rocha, R., Ovaskainen, O., López-Baucells, A., Farneda, F. Z., Sampaio, E. M., Bobrowiec, P.E.D, Cabeza, M., Palmeirim, J. M. and Meyer, C. F. J. 2018. Secondary forest regeneration benefits old-growth specialist bats in a fragmented tropical landscape. Scientific Reports 8, 3819.

Häkkilä, M., Abrego, N., Ovaskainen, O. and Mönkkönen, M. 2018. Habitat quality is more important than matrix quality for bird communities in protected areas. Ecology and Evolution 8, 4019-4030.

Lammel, D. R., Barth, G., Ovaskainen, O., Cruz, L. M., Zanatta, J. A., Ryo, M., Souza, E. M. and Pedrosa, F. O. 2018. Direct and indirect effects of a pH gradient bring insights into the mechanisms driving prokaryotic community structures. Microbiome 6, 106.

Abrego, N., Dunson, D., Halme, P., Salcedo, I. and Ovaskainen, O. 2017. Wood-inhabiting fungi with tight associations with other species have declined as a response to forest management. Oikos 126, 269-275.

Rocha, R., Ovaskainen, O., López-Baucells, A., Farneda, F. Z., Ferreira, D. F., Bobrowiec, P.E.D, Cabeza, M., Palmeirim, J. M. and Meyer, C. F. J. 2017. Design matters: an evaluation of the impact of small man-made forest clearings on tropical bats using a before-after-control-impact design. Forest Ecology and Management 401, 8-16.