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:

  • Teachers: Otso Ovaskainen, Nerea Abrego, Mirkka Jones, Jari Oksanen, Øystein Opedal, Gleb Tikhonov & Bess Hardwick.
  • Course dates: November 2nd-6th 2020
  • Venue: zoom
  • Course Overview: This course is designed 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 timing: how do we manage global participation?  We have 123 registrations from Europe+Africa, 77 from America, and 39 from Australasia. All times in this document are GMT+0. The baseline course will run every day from 9am to 3pm, with one hour allocated to breaks, so 5 hours of active teaching for each of the five days. All lectures and computer demonstrations will be recorded, so those for whom these times are difficult can watch the recorded versions. Break-out groups will be organized also in the evening (GMT 4pm-6pm; should be convenient for America) and in the morning (GMT 6am-8am; should be convenient for Australasia). The entire event will happen in zoom. Questions in plenary session are to be asked primarily by chat.
  • Registration is now closed. Participants will be prioritized according to registration order and relevance.
  • You can receive a signed certificate stating that you have successfully completed this 2 ECTS course - hopefully your university will then agree to register the credits.
    • To achieve the study credits, you should turn in a learning diary at the end of the course (2 5 pages in total, pdf file), where you summarize in your own words what you learned during each of the course days. Send the pdf file to, with email subject learning_diary_surname_firstname , e.g. learning_diary_ovaskainen_otso
    • If you are a student at Helsinki, we can register your credits directly.
  • 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.