{"id":11969,"name":"sdmTMB","description":"An R package that fits spatial and spatiotemporal predictive-processes for species distribution models.","url":"https://github.com/sdmTMB/sdmTMB","last_synced_at":"2026-06-01T02:02:27.383Z","repository":{"id":37269744,"uuid":"149399567","full_name":"sdmTMB/sdmTMB","owner":"sdmTMB","description":"An R package for spatial and spatiotemporal GLMMs with TMB","archived":false,"fork":false,"pushed_at":"2026-05-12T21:52:03.000Z","size":38279,"stargazers_count":247,"open_issues_count":31,"forks_count":29,"subscribers_count":16,"default_branch":"main","last_synced_at":"2026-05-20T03:02:08.007Z","etag":null,"topics":["ecology","glmm","r","spatial-analysis","species-distribution-modelling","tmb"],"latest_commit_sha":null,"homepage":"https://sdmTMB.github.io/sdmTMB/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sdmTMB.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-09-19T05:59:53.000Z","updated_at":"2026-05-13T14:25:19.000Z","dependencies_parsed_at":"2026-04-23T01:00:33.924Z","dependency_job_id":null,"html_url":"https://github.com/sdmTMB/sdmTMB","commit_stats":{"total_commits":2312,"total_committers":18,"mean_commits":"128.44444444444446","dds":"0.15138408304498274","last_synced_commit":"af6267e873c0069b3b6d05530cc4482050946a66"},"previous_names":["sdmtmb/sdmtmb","pbs-assess/sdmtmb"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/sdmTMB/sdmTMB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdmTMB%2FsdmTMB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdmTMB%2FsdmTMB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdmTMB%2FsdmTMB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdmTMB%2FsdmTMB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdmTMB","download_url":"https://codeload.github.com/sdmTMB/sdmTMB/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdmTMB%2FsdmTMB/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33269199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-20T15:12:43.734Z","status":"ssl_error","status_checked_at":"2026-05-20T15:12:42.300Z","response_time":356,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"owner":{"login":"sdmTMB","name":"sdmTMB","uuid":"245077094","kind":"organization","description":null,"email":null,"website":null,"location":null,"twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/245077094?v=4","repositories_count":1,"last_synced_at":"2025-11-21T23:02:51.285Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/sdmTMB","funding_links":[],"total_stars":228,"followers":0,"following":0,"created_at":"2025-11-21T23:02:51.308Z","updated_at":"2025-11-21T23:02:51.308Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdmTMB","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdmTMB/repositories"},"packages":[{"id":5856311,"name":"sdmTMB","ecosystem":"cran","description":"Spatial and Spatiotemporal SPDE-Based GLMMs with 'TMB'","homepage":"https://sdmTMB.github.io/sdmTMB/","licenses":"GPL-3","normalized_licenses":["GPL-3.0"],"repository_url":"https://github.com/sdmTMB/sdmTMB","keywords_array":[],"namespace":null,"versions_count":14,"first_release_published_at":"2023-01-10T00:00:00.000Z","latest_release_published_at":"2026-01-24T00:00:00.000Z","latest_release_number":"1.0.0","last_synced_at":"2026-05-22T01:02:04.974Z","created_at":"2023-01-10T19:39:44.524Z","updated_at":"2026-05-22T01:02:04.975Z","registry_url":"https://cran.r-project.org/package=sdmTMB","install_command":null,"documentation_url":"http://cran.r-project.org/web/packages/sdmTMB/sdmTMB.pdf","metadata":{},"repo_metadata":{"id":37269744,"uuid":"149399567","full_name":"pbs-assess/sdmTMB","owner":"pbs-assess","description":":earth_americas: An R package for spatial and spatiotemporal GLMMs with TMB","archived":false,"fork":false,"pushed_at":"2024-10-03T00:38:09.000Z","size":367319,"stargazers_count":187,"open_issues_count":48,"forks_count":27,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-10-29T20:37:49.654Z","etag":null,"topics":["ecology","glmm","r","spatial-analysis","species-distribution-modelling","tmb"],"latest_commit_sha":null,"homepage":"https://pbs-assess.github.io/sdmTMB/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pbs-assess.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-19T05:59:53.000Z","updated_at":"2024-10-11T08:57:03.000Z","dependencies_parsed_at":"2023-12-18T23:28:02.690Z","dependency_job_id":"cf770752-ef43-4e22-98f3-1ffda2664cc8","html_url":"https://github.com/pbs-assess/sdmTMB","commit_stats":{"total_commits":2225,"total_committers":19,"mean_commits":"117.10526315789474","dds":"0.15460674157303367","last_synced_commit":"c944c0e8bc8e23a7869b252886e833a568b42ad4"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pbs-assess","download_url":"https://codeload.github.com/pbs-assess/sdmTMB/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222131010,"owners_count":16936304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"},"owner_record":{"login":"pbs-assess","name":"pbs-assess","uuid":"37125935","kind":"organization","description":null,"email":null,"website":null,"location":null,"twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/37125935?v=4","repositories_count":30,"last_synced_at":"2023-03-02T09:35:13.042Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/pbs-assess","funding_links":[],"total_stars":null,"followers":null,"following":null,"created_at":"2022-11-13T02:25:02.510Z","updated_at":"2023-03-02T09:35:13.084Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pbs-assess","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pbs-assess/repositories"},"tags":[{"name":"v0.6.0","sha":"708d613a7c5fe78696b78acb286013f7a3313dbf","kind":"commit","published_at":"2024-05-29T03:14:15.000Z","download_url":"https://codeload.github.com/pbs-assess/sdmTMB/tar.gz/v0.6.0","html_url":"https://github.com/pbs-assess/sdmTMB/releases/tag/v0.6.0","dependencies_parsed_at":null,"dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.6.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.6.0/manifests"},{"name":"v0.5.0","sha":"ad5db932bc6f4aaa7c456cb21b8f56c44d9addc1","kind":"commit","published_at":"2024-04-03T19:47:08.000Z","download_url":"https://codeload.github.com/pbs-assess/sdmTMB/tar.gz/v0.5.0","html_url":"https://github.com/pbs-assess/sdmTMB/releases/tag/v0.5.0","dependencies_parsed_at":null,"dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.5.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.5.0/manifests"},{"name":"v0.4.3","sha":"5f87d317a27adc37ca42601dc190cf0e0358feb5","kind":"commit","published_at":"2024-02-28T21:53:40.000Z","download_url":"https://codeload.github.com/pbs-assess/sdmTMB/tar.gz/v0.4.3","html_url":"https://github.com/pbs-assess/sdmTMB/releases/tag/v0.4.3","dependencies_parsed_at":null,"dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.4.3","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.4.3/manifests"},{"name":"v0.4.2","sha":"87aad07cf2f77a2598e11a5b46171db72e5f3ae7","kind":"commit","published_at":"2024-01-18T01:17:58.000Z","download_url":"https://codeload.github.com/pbs-assess/sdmTMB/tar.gz/v0.4.2","html_url":"https://github.com/pbs-assess/sdmTMB/releases/tag/v0.4.2","dependencies_parsed_at":null,"dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.4.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.4.2/manifests"},{"name":"v0.4.1","sha":"1506e31f1507016fb23083b6c812c33f3dd8371c","kind":"commit","published_at":"2023-11-02T18:40:06.000Z","download_url":"https://codeload.github.com/pbs-assess/sdmTMB/tar.gz/v0.4.1","html_url":"https://github.com/pbs-assess/sdmTMB/releases/tag/v0.4.1","dependencies_parsed_at":null,"dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.4.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.4.1/manifests"},{"name":"v0.4.0","sha":"408311fb7061e66d207b7f3a8dfb94b3b7e1351c","kind":"commit","published_at":"2023-10-19T18:32:28.000Z","download_url":"https://codeload.github.com/pbs-assess/sdmTMB/tar.gz/v0.4.0","html_url":"https://github.com/pbs-assess/sdmTMB/releases/tag/v0.4.0","dependencies_parsed_at":null,"dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.4.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.4.0/manifests"},{"name":"v0.3.0","sha":"d3744b86a9fb4a66b67e82ccbc8af4c91b0d0b34","kind":"commit","published_at":"2023-01-27T18:05:13.000Z","download_url":"https://codeload.github.com/pbs-assess/sdmTMB/tar.gz/v0.3.0","html_url":"https://github.com/pbs-assess/sdmTMB/releases/tag/v0.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/tags/v0.3.0/manifests"}]},"repo_metadata_updated_at":"2024-10-29T23:15:30.552Z","dependent_packages_count":1,"downloads":6668,"downloads_period":"last-month","dependent_repos_count":2,"rankings":{"downloads":17.43550354674016,"dependent_repos_count":19.608552185508294,"dependent_packages_count":27.965297546428086,"stargazers_count":3.1401075317399356,"forks_count":5.552794469796232,"docker_downloads_count":null,"average":14.740451056042541},"purl":"pkg:cran/sdmTMB","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/cran/sdmTMB","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/cran/sdmTMB","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/cran/sdmTMB/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":{"last_synced_at":"2024-10-29T19:33:47.573Z","issues_count":167,"pull_requests_count":33,"avg_time_to_close_issue":7250876.909090909,"avg_time_to_close_pull_request":1774234.5666666667,"issues_closed_count":121,"pull_requests_closed_count":30,"pull_request_authors_count":10,"issue_authors_count":32,"avg_comments_per_issue":2.2694610778443116,"avg_comments_per_pull_request":1.3939393939393938,"merged_pull_requests_count":25,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":53,"past_year_pull_requests_count":16,"past_year_avg_time_to_close_issue":1302032.0512820513,"past_year_avg_time_to_close_pull_request":839412.7142857143,"past_year_issues_closed_count":39,"past_year_pull_requests_closed_count":14,"past_year_pull_request_authors_count":8,"past_year_issue_authors_count":18,"past_year_avg_comments_per_issue":2.30188679245283,"past_year_avg_comments_per_pull_request":0.5625,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":13,"issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbs-assess%2FsdmTMB/issues","maintainers":[{"login":"seananderson","count":88,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/seananderson"},{"login":"ericward-noaa","count":40,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ericward-noaa"},{"login":"ecophilina","count":9,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ecophilina"},{"login":"Lewis-Barnett-NOAA","count":7,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/Lewis-Barnett-NOAA"},{"login":"James-Thorson-NOAA","count":3,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/James-Thorson-NOAA"},{"login":"jindivero","count":3,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/jindivero"}],"active_maintainers":[{"login":"seananderson","count":22,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/seananderson"},{"login":"ericward-noaa","count":11,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ericward-noaa"},{"login":"Lewis-Barnett-NOAA","count":6,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/Lewis-Barnett-NOAA"},{"login":"James-Thorson-NOAA","count":3,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/James-Thorson-NOAA"},{"login":"ecophilina","count":1,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ecophilina"}]},"versions_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/packages/sdmTMB/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/packages/sdmTMB/version_numbers","latest_version_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/packages/sdmTMB/latest_version","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/packages/sdmTMB/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/packages/sdmTMB/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/packages/sdmTMB/codemeta","maintainers":[{"uuid":"sean@seananderson.ca","login":null,"name":"Sean C. Anderson","email":"sean@seananderson.ca","url":null,"packages_count":3,"html_url":null,"role":null,"created_at":"2023-01-10T19:39:53.256Z","updated_at":"2023-01-10T19:39:53.256Z","packages_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/maintainers/sean@seananderson.ca/packages"}],"registry":{"name":"cran.r-project.org","url":"https://cran.r-project.org","ecosystem":"cran","default":true,"packages_count":28453,"maintainers_count":15790,"namespaces_count":0,"keywords_count":0,"github":"r-project-org","metadata":{"icon_url":"https://cran.r-project.org/CRANlogo.png"},"icon_url":"https://cran.r-project.org/CRANlogo.png","created_at":"2022-04-06T16:32:25.637Z","updated_at":"2026-04-27T18:20:16.286Z","packages_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/packages","maintainers_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/maintainers","namespaces_url":"https://packages.ecosyste.ms/api/v1/registries/cran.r-project.org/namespaces"}}],"commits":{"id":11567896,"full_name":"sdmTMB/sdmTMB","default_branch":"master","total_commits":2794,"total_committers":21,"total_bot_commits":0,"total_bot_committers":0,"mean_commits":133.04761904761904,"dds":0.15748031496062997,"past_year_total_commits":319,"past_year_total_committers":5,"past_year_total_bot_commits":0,"past_year_total_bot_committers":0,"past_year_mean_commits":63.8,"past_year_dds":0.12852664576802508,"last_synced_at":"2026-05-23T02:13:10.342Z","last_synced_commit":"150bc704e24d247e679b96366a861e3d95235234","created_at":"2025-11-21T23:01:36.285Z","updated_at":"2026-05-23T02:12:23.092Z","committers":[{"name":"Sean Anderson","email":"sean@seananderson.ca","login":"seananderson","count":2354},{"name":"ericward-noaa","email":"eric.ward@noaa.gov","login":"ericward-noaa","count":226},{"name":"ecophilina","email":"paenglis@lakeheadu.ca","login":"ecophilina","count":113},{"name":"jindivero","email":"84645567+jindivero","login":"jindivero","count":40},{"name":"Jillian Dunic","email":"","login":null,"count":16},{"name":"J Dunic","email":"jdunic@gmail.com","login":"jdunic","count":11},{"name":"Eric Ward","email":"eric-ward","login":"eric-ward","count":6},{"name":"Lewis-Barnett-NOAA","email":"1361087+Lewis-Barnett-NOAA","login":"Lewis-Barnett-NOAA","count":6},{"name":"Joseph Barss","email":"jospbarss@gmail.com","login":"Joseph-Barss","count":5},{"name":"Jim Thorson","email":"James.T.Thorson@gmail.com","login":"James-Thorson","count":3},{"name":"Sebastian Pardo","email":"sebpardo@gmail.com","login":"sebpardo","count":2},{"name":"olivroy","email":"olivierroy71@hotmail.com","login":"olivroy","count":2},{"name":"Claude","email":"noreply@anthropic.com","login":null,"count":2},{"name":"Ben Bolker","email":"bbolker@gmail.com","login":"bbolker","count":1},{"name":"Elise Keppel","email":"elise.keppel@dfo-mpo.gc.ca","login":"elisekeppel","count":1},{"name":"Gavin Fay","email":"gavinfay","login":"gavinfay","count":1},{"name":"francisvolh","email":"48733609+francisvolh","login":"francisvolh","count":1},{"name":"joenomiddlename","email":"watsonjoe8@gmail.com","login":"joenomiddlename","count":1},{"name":"Watson","email":"Joe.Watson@dfo-mpo.gc.ca","login":null,"count":1},{"name":"Chris Grandin","email":"cgrandin@shaw.ca","login":null,"count":1},{"name":"kellijohnson-NOAA","email":"kelli.johnson@noaa.gov","login":"kellijohnson-NOAA","count":1}],"past_year_committers":[{"name":"Sean Anderson","email":"sean@seananderson.ca","login":"seananderson","count":278},{"name":"ericward-noaa","email":"eric.ward@noaa.gov","login":"ericward-noaa","count":33},{"name":"Joseph Barss","email":"jospbarss@gmail.com","login":"Joseph-Barss","count":5},{"name":"Claude","email":"noreply@anthropic.com","login":null,"count":2},{"name":"Gavin Fay","email":"gavinfay","login":"gavinfay","count":1}],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdmTMB%2FsdmTMB/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-05-24T00:00:21.472Z","repositories_count":6240234,"commits_count":884616171,"contributors_count":34913333,"owners_count":1156825,"icon_url":"https://github.com/github.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories"}},"issues_stats":{"full_name":"sdmTMB/sdmTMB","html_url":"https://github.com/sdmTMB/sdmTMB","last_synced_at":"2026-05-22T04:11:05.041Z","status":null,"issues_count":14,"pull_requests_count":1,"avg_time_to_close_issue":1815026.8333333333,"avg_time_to_close_pull_request":21052.0,"issues_closed_count":6,"pull_requests_closed_count":1,"pull_request_authors_count":1,"issue_authors_count":6,"avg_comments_per_issue":2.7857142857142856,"avg_comments_per_pull_request":1.0,"merged_pull_requests_count":1,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":14,"past_year_pull_requests_count":1,"past_year_avg_time_to_close_issue":1815026.8333333333,"past_year_avg_time_to_close_pull_request":21052.0,"past_year_issues_closed_count":6,"past_year_pull_requests_closed_count":1,"past_year_pull_request_authors_count":1,"past_year_issue_authors_count":6,"past_year_avg_comments_per_issue":2.7857142857142856,"past_year_avg_comments_per_pull_request":1.0,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":1,"created_at":"2025-11-21T23:01:40.271Z","updated_at":"2026-05-22T04:11:05.042Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdmTMB%2FsdmTMB","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdmTMB%2FsdmTMB/issues","issue_labels_count":{"enhancement":1},"pull_request_labels_count":{},"issue_author_associations_count":{"COLLABORATOR":8,"NONE":4,"CONTRIBUTOR":2},"pull_request_author_associations_count":{"CONTRIBUTOR":1},"issue_authors":{"seananderson":5,"jebyrnes":3,"ericward-noaa":2,"James-Thorson":2,"MZink06":1,"James-Thorson-NOAA":1},"pull_request_authors":{"gavinfay":1},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-05-25T00:00:55.688Z","repositories_count":14693049,"issues_count":33981853,"pull_requests_count":111268490,"authors_count":11273178,"icon_url":"https://github.com/github.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors"},"past_year_issue_labels_count":{"enhancement":1},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{"COLLABORATOR":8,"NONE":4,"CONTRIBUTOR":2},"past_year_pull_request_author_associations_count":{"CONTRIBUTOR":1},"past_year_issue_authors":{"seananderson":5,"jebyrnes":3,"ericward-noaa":2,"James-Thorson":2,"James-Thorson-NOAA":1,"MZink06":1},"past_year_pull_request_authors":{"gavinfay":1},"maintainers":[{"login":"seananderson","count":5,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/seananderson"},{"login":"ericward-noaa","count":2,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ericward-noaa"},{"login":"James-Thorson-NOAA","count":1,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/James-Thorson-NOAA"}],"active_maintainers":[{"login":"seananderson","count":5,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/seananderson"},{"login":"ericward-noaa","count":2,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ericward-noaa"},{"login":"James-Thorson-NOAA","count":1,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/James-Thorson-NOAA"}]},"events":{"total":{"ReleaseEvent":1,"DeleteEvent":2,"MemberEvent":9,"PullRequestEvent":2,"DiscussionEvent":3,"IssuesEvent":8,"WatchEvent":4,"IssueCommentEvent":14,"PushEvent":59,"CreateEvent":3},"last_year":{"ReleaseEvent":1,"DeleteEvent":2,"MemberEvent":9,"PullRequestEvent":2,"DiscussionEvent":3,"IssuesEvent":8,"WatchEvent":4,"IssueCommentEvent":14,"PushEvent":59,"CreateEvent":3}},"keywords":["ecology","glmm","r","spatial-analysis","species-distribution-modelling","tmb"],"dependencies":[{"ecosystem":"actions","filepath":".github/workflows/R-CMD-check-valgrind2.yaml","sha":null,"kind":"manifest","created_at":"2023-02-19T10:45:37.786Z","updated_at":"2023-02-19T10:45:37.786Z","repository_link":"https://github.com/sdmTMB/sdmTMB/blob/main/.github/workflows/R-CMD-check-valgrind2.yaml","dependencies":[{"id":7785678102,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785678139,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785678141,"package_name":"r-lib/actions/setup-pandoc","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785678142,"package_name":"actions/cache","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785678144,"package_name":"actions/upload-artifact","ecosystem":"actions","requirements":"main","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/R-CMD-check.yaml","sha":null,"kind":"manifest","created_at":"2023-02-19T10:45:37.996Z","updated_at":"2023-02-19T10:45:37.996Z","repository_link":"https://github.com/sdmTMB/sdmTMB/blob/main/.github/workflows/R-CMD-check.yaml","dependencies":[{"id":7785679942,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785679943,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785679944,"package_name":"r-lib/actions/setup-pandoc","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785679945,"package_name":"actions/cache","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785679946,"package_name":"actions/upload-artifact","ecosystem":"actions","requirements":"main","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/pkgdown.yaml","sha":null,"kind":"manifest","created_at":"2023-02-19T10:45:38.284Z","updated_at":"2023-02-19T10:45:38.284Z","repository_link":"https://github.com/sdmTMB/sdmTMB/blob/main/.github/workflows/pkgdown.yaml","dependencies":[{"id":7785685480,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":7785685481,"package_name":"r-lib/actions/setup-pandoc","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785685482,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785685483,"package_name":"r-lib/actions/setup-r-dependencies","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7785685484,"package_name":"JamesIves/github-pages-deploy-action","ecosystem":"actions","requirements":"v4.4.1","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"cran","filepath":"DESCRIPTION","sha":null,"kind":"manifest","created_at":"2023-02-19T10:45:38.732Z","updated_at":"2023-02-19T10:45:38.732Z","repository_link":"https://github.com/sdmTMB/sdmTMB/blob/main/DESCRIPTION","dependencies":[{"id":7785688409,"package_name":"R","ecosystem":"cran","requirements":"\u003e= 3.5.0","direct":true,"kind":"depends","optional":false},{"id":7785688416,"package_name":"assertthat","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785688453,"package_name":"clisymbols","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785688456,"package_name":"cli","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785688480,"package_name":"fishMod","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785688519,"package_name":"generics","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785688679,"package_name":"glmmTMB","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785688691,"package_name":"graphics","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785688699,"package_name":"lifecycle","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785688768,"package_name":"Matrix","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785689100,"package_name":"methods","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785689131,"package_name":"mgcv","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785689144,"package_name":"mvtnorm","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785689145,"package_name":"nlme","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785689146,"package_name":"rlang","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785689147,"package_name":"stats","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":7785689148,"package_name":"TMB","ecosystem":"cran","requirements":"\u003e= 1.8.0","direct":true,"kind":"imports","optional":false},{"id":7785689149,"package_name":"dplyr","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689150,"package_name":"effects","ecosystem":"cran","requirements":"\u003e= 4.0","direct":true,"kind":"suggests","optional":false},{"id":7785689151,"package_name":"estimability","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689152,"package_name":"emmeans","ecosystem":"cran","requirements":"\u003e= 1.4","direct":true,"kind":"suggests","optional":false},{"id":7785689153,"package_name":"future","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689154,"package_name":"future.apply","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689155,"package_name":"ggeffects","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689156,"package_name":"ggforce","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689157,"package_name":"ggplot2","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689158,"package_name":"INLA","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689159,"package_name":"knitr","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689160,"package_name":"lme4","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689170,"package_name":"rgdal","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689171,"package_name":"rmarkdown","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689172,"package_name":"sf","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689173,"package_name":"splancs","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689174,"package_name":"testthat","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689175,"package_name":"tibble","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":7785689176,"package_name":"visreg","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/R-CMD-check-HTML5.yaml","sha":null,"kind":"manifest","created_at":"2023-12-02T05:11:45.699Z","updated_at":"2023-12-02T05:11:45.699Z","repository_link":"https://github.com/sdmTMB/sdmTMB/blob/main/.github/workflows/R-CMD-check-HTML5.yaml","dependencies":[{"id":14851130890,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":14851130891,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":14851130892,"package_name":"r-lib/actions/setup-r-dependencies","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":14851130893,"package_name":"r-lib/actions/check-r-package","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/rhub-manual.yaml","sha":null,"kind":"manifest","created_at":"2023-12-02T05:11:45.715Z","updated_at":"2023-12-02T05:11:45.715Z","repository_link":"https://github.com/sdmTMB/sdmTMB/blob/main/.github/workflows/rhub-manual.yaml","dependencies":[{"id":14851130894,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":14851130895,"package_name":"r-lib/actions/check-r-package","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/rhub.yaml","sha":null,"kind":"manifest","created_at":"2023-12-02T05:11:45.721Z","updated_at":"2023-12-02T05:11:45.721Z","repository_link":"https://github.com/sdmTMB/sdmTMB/blob/main/.github/workflows/rhub.yaml","dependencies":[{"id":14851130896,"package_name":"r-hub/rhub2/actions/rhub-setup","ecosystem":"actions","requirements":"v1","direct":true,"kind":"composite","optional":false},{"id":14851130897,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":14851130898,"package_name":"r-hub/rhub2/actions/rhub-check","ecosystem":"actions","requirements":"v1","direct":true,"kind":"composite","optional":false},{"id":14851130899,"package_name":"r-hub/rhub2/actions/rhub-setup-r","ecosystem":"actions","requirements":"v1","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/R-CMD-check-valgrind3.yaml","sha":null,"kind":"manifest","created_at":"2026-03-05T07:00:40.045Z","updated_at":"2026-03-05T07:00:40.045Z","repository_link":"https://github.com/sdmTMB/sdmTMB/blob/main/.github/workflows/R-CMD-check-valgrind3.yaml","dependencies":[{"id":25831549457,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false},{"id":25831549458,"package_name":"r-lib/actions/setup-pandoc","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":25831549461,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":25831549462,"package_name":"r-lib/actions/setup-r-dependencies","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":25831549482,"package_name":"actions/upload-artifact","ecosystem":"actions","requirements":"main","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/test-coverage.yaml","sha":null,"kind":"manifest","created_at":"2026-03-05T07:00:41.336Z","updated_at":"2026-03-05T07:00:41.336Z","repository_link":"https://github.com/sdmTMB/sdmTMB/blob/main/.github/workflows/test-coverage.yaml","dependencies":[{"id":25831549489,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false},{"id":25831549490,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":25831549491,"package_name":"r-lib/actions/setup-r-dependencies","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":25831549492,"package_name":"actions/upload-artifact","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false}]}],"score":17.47781849545264,"created_at":"2023-09-11T14:41:06.133Z","updated_at":"2026-06-01T02:02:27.393Z","avatar_url":"https://github.com/sdmTMB.png","language":"R","category":"Biosphere","sub_category":"Species Distribution Modeling","monthly_downloads":6668,"total_dependent_repos":2,"total_dependent_packages":1,"readme":"---\noutput: \n  github_document:\n    toc: true\n    toc_depth: 3\n    df_print: \"tibble\"\n    includes:\n      in_header: header.md\n---\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"50%\",\n  cache = FALSE,\n  autodep = TRUE,\n  dpi = 72\n)\n```\n    \n## Installation\n\nsdmTMB can be installed from CRAN:\n\n```{r, eval=FALSE}\ninstall.packages(\"sdmTMB\", dependencies = TRUE)\n```\n\nAssuming you have a [C++ compiler](https://support.posit.co/hc/en-us/articles/200486498-Package-Development-Prerequisites) installed, the development version is recommended and can be installed:\n\n```{r, eval=FALSE}\n# install.packages(\"pak\")\npak::pak(\"sdmTMB/sdmTMB\", dependencies = TRUE)\n```\n\nThere are some extra utilities in the [sdmTMBextra](https://github.com/sdmTMB/sdmTMBextra) package.\n\nFor large models, it is recommended to use an optimized BLAS library, which will result in major speed improvements for TMB (and other) models in R (e.g., often 8-fold speed increases for sdmTMB models).\nSuggested installation instructions for [Mac users](https://www.mail-archive.com/r-sig-mac@r-project.org/msg06199.html) (other than R 4.5.0) or [with OpenBLAS on a Mac](https://gist.github.com/seananderson/3c6cbf640ba566ce936c79442b9a6068), [Linux users](https://prdm0.github.io/ropenblas/), [Windows users](https://github.com/david-cortes/R-openblas-in-windows), and [Windows users without admin privileges](https://gist.github.com/seananderson/08a51e296a854f227a908ddd365fb9c1).\nTo check that you've successfully linked the optimized BLAS, start a new session and run:\n\n```r\nm \u003c- 1e4; n \u003c- 1e3; k \u003c- 3e2\nX \u003c- matrix(rnorm(m*k), nrow=m); Y \u003c- matrix(rnorm(n*k), ncol=n)\nsystem.time(X %*% Y)\n```\n\nThe result ('elapsed') should take a fraction of a second (e.g., 0.03 s), not \u003e 1 second.\n\n## Overview\n\nAnalyzing geostatistical data (coordinate-referenced observations from some underlying spatial process) is becoming increasingly common in many fields.\nsdmTMB implements geostatistical spatial and spatiotemporal GLMMs using [TMB](https://cran.r-project.org/package=TMB) for model fitting and [fmesher](https://CRAN.R-project.org/package=fmesher) to set up SPDE matrices (for the [stochastic partial differential equation approach](https://doi.org/10.1111/j.1467-9868.2011.00777.x); a computationally efficient method for modeling spatial correlation).\nOne common application is for species distribution models (SDMs), hence the package name.\nThe goal of sdmTMB is to provide a fast, flexible, and user-friendly interface---similar to the popular R package glmmTMB---but with a focus on spatial and spatiotemporal models with an SPDE approach.\nWe extend common generalized linear mixed models (GLMMs) to include the following optional features:\n\n* spatial random fields\n* spatiotemporal random fields that may be independent by year or modelled with random walks or autoregressive processes\n* smooth terms for covariates, using the familiar `s()` notation from mgcv\n* breakpoint (hockey-stick) or logistic covariates\n* time-varying covariates (coefficients modelled as random walks)\n* spatially varying coefficient models (SVCs)\n* interpolation or forecasting over missing or future time slices\n* a wide range of families: all standard R families plus `tweedie()`, `nbinom1()`, `nbinom2()`, `lognormal()`, `student()`, `gengamma()`, plus some truncated and censored families\n* delta/hurdle models including `delta_gamma()`, `delta_lognormal()`, and `delta_truncated_nbinom2()`\n\nEstimation is via maximum marginal likelihood (with random effects integrated out) with the objective function calculated in [TMB](https://cran.r-project.org/package=TMB) and minimized in R via `stats::nlminb()` with the random effects integrated over via the Laplace approximation.\nThe sdmTMB package also allows for models to be passed to Stan via [tmbstan](https://cran.r-project.org/package=tmbstan), allowing for Bayesian model estimation.\n\nSee [`?sdmTMB`](https://sdmTMB.github.io/sdmTMB/reference/sdmTMB.html) and [`?predict.sdmTMB`](https://sdmTMB.github.io/sdmTMB/reference/predict.sdmTMB.html) for the most complete examples. Also see the vignettes ('Articles') on the [documentation site](https://sdmTMB.github.io/sdmTMB/index.html) and the [preprint](https://doi.org/10.1101/2022.03.24.485545) listed below.\n\n## Getting help\n\nFor questions about how to use sdmTMB or interpret the models, please post on the [discussion board](https://github.com/sdmTMB/sdmTMB/discussions). If you [email](https://github.com/sdmTMB/sdmTMB/blob/main/DESCRIPTION) a question, we are likely to respond on the [discussion board](https://github.com/sdmTMB/sdmTMB/discussions) with an anonymized version of your question (and without data) if we think it could be helpful to others. Please let us know if you don't want us to do that.\n\nFor bugs or feature requests, please post in the [issue tracker](https://github.com/sdmTMB/sdmTMB/issues).\n\nThere have been several [past sdmTMB workshops](https://github.com/sdmTMB/sdmTMB-teaching). \nSlides and exercises from the latest workshop are available [here](https://github.com/sdmTMB/sdmTMB-TESA-2025).\n[Recordings](https://www.youtube.com/channel/UCYoFG51RjJVx7m9mZGaj-Ng/videos) from an older workshop are also available.\n\n## Citation\n\nTo cite sdmTMB in publications, please use:\n\n```r\ncitation(\"sdmTMB\")\n```\n\nAnderson, S.C., E.J. Ward, P.A. English, L.A.K. Barnett., J.T. Thorson. 2025.\nsdmTMB: an R package for fast, flexible, and user-friendly generalized linear\nmixed effects models with spatial and spatiotemporal random fields.\nJournal of Statistical Software. 115(2):1--46.\n\u003chttps://doi.org/10.18637/jss.v115.i02\u003e.\n\nbioRxiv preprint: \u003chttps://doi.org/10.1101/2022.03.24.485545\u003e.\n\nA list of known publications that use sdmTMB can be found [here](https://github.com/sdmTMB/sdmTMB/tree/main/scratch/citations). Please use the above citation so we can track publications.\n\n## Basic use\n\nAn sdmTMB model requires a data frame that contains a response column, columns for any predictors, and columns for spatial coordinates.\nIt usually makes sense to convert the spatial coordinates to an equidistant projection such as UTMs such that 1 km remains the same distance throughout the study region (unlike latitude/longitude) [e.g., using `sf::st_transform()`].\nHere, we illustrate a spatial model fit to Pacific cod (*Gadus macrocephalus*) trawl survey data from Queen Charlotte Sound, BC, Canada.\nOur model contains a main effect of depth as a penalized smoother, a spatial random field, and Tweedie observation error.\nOur data frame `pcod` (built into the package) has a column `year` for the year of the survey, `density` for density of Pacific cod in a given survey tow, `present` for whether `density \u003e 0`, `depth` for depth in meters of that tow, and spatial coordinates `X` and `Y`, which are UTM coordinates in kilometres.\n\n```{r, echo=TRUE, eval=FALSE, cache=FALSE}\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(sdmTMB)\nhead(pcod)\n```\n\n```{r, echo=FALSE, eval=TRUE, message=FALSE, warning=FALSE, cache=FALSE}\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(sdmTMB)\ntheme_set(theme_light())\ndplyr::select(pcod, year, density, present, depth, X, Y) %\u003e% \n  head(n = 3)\n```\n\nWe start by creating a mesh object that contains a triangular network used to approximate the spatial field (a \"finite element mesh\").\n\n```{r}\nmesh \u003c- make_mesh(pcod, xy_cols = c(\"X\", \"Y\"), cutoff = 10)\n```\n\nHere, `cutoff` defines the minimum allowed distance between mesh vertices in the units of `X` and `Y` (km). Smaller values create finer meshes but increase computation time. Alternatively, we could have created a mesh via the fmesher or INLA packages and supplied it to `make_mesh()`. \nWe can inspect our mesh object with the associated plotting method `plot(mesh)`.\n\nFit a spatial model with a smoother for depth:\n\n```{r, warning=FALSE, message=FALSE}\nfit \u003c- sdmTMB(\n  density ~ s(depth),\n  data = pcod,\n  mesh = mesh,\n  family = tweedie(link = \"log\"),\n  spatial = \"on\"\n)\n```\n\nPrint the model fit:\n\n```{r}\nfit\n```\n\nThe output shows our model was fit by maximum marginal likelihood (`ML`), followed by the formula, mesh, data, and family. The main effects section includes the linear component of the depth smoother (`sdepth`) and the standard deviation on the smoother weights (`sds(depth)`). The Tweedie dispersion (`phi`) and power parameters control the distribution's mean-variance relationship. The Matérn range is the distance at which spatial correlation becomes negligible (~0.13 correlation). The marginal spatial field standard deviation (`sigma_O`) represents unexplained spatial variation. The log likelihood represents the objective function value at convergence.\n\nWe can extract parameters as a data frame:\n\n```{r}\ntidy(fit, conf.int = TRUE)\ntidy(fit, effects = \"ran_pars\", conf.int = TRUE)\n```\n\nRun some basic sanity checks on our model:\n\n```{r}\nsanity(fit)\n```\n\nUse the [ggeffects](https://github.com/strengejacke/ggeffects) package to plot the smoother effect:\n\n```{r plot-ggpredict-link, warning=FALSE, message=FALSE}\nggeffects::ggpredict(fit, \"depth [50:400, by=2]\") |\u003e plot()\n```\n\nIf the depth effect was parametric and not a penalized smoother, we could have alternatively used `ggeffects::ggeffect()` for a fast marginal effect plot.\n\nNext, we can predict on new data.\nWe will use a data frame `qcs_grid` from the package, which contains all the locations (and covariates) at which we wish to predict.\nHere, these `newdata` are a grid, or raster, covering our survey.\n\n```{r}\np \u003c- predict(fit, newdata = qcs_grid)\n```\n\n```{r, eval=FALSE, echo=TRUE}\nhead(p)\n```\n\n```{r, eval=TRUE, echo=FALSE}\nselect(p, X, Y, depth, est, est_non_rf, est_rf, omega_s) %\u003e% \n  head(n = 3)\n```\n\nWe exponentiate the predictions with `exp()` to transform from log-link space back to the density scale:\n\n```{r plot-predictions}\nggplot(p, aes(X, Y, fill = exp(est))) + geom_raster() +\n  scale_fill_viridis_c(trans = \"sqrt\")\n```\n\nWe could switch to a presence-absence model by changing the response column and family:\n\n```{r, eval=TRUE}\nfit \u003c- sdmTMB(\n  present ~ s(depth),\n  data = pcod, \n  mesh = mesh,\n  family = binomial(link = \"logit\")\n)\n```\n\nOr a hurdle/delta model by changing the family:\n\n```{r, eval=TRUE}\nfit \u003c- sdmTMB(\n  density ~ s(depth),\n  data = pcod,\n  mesh = mesh,\n  family = delta_gamma(link1 = \"logit\", link2 = \"log\"),\n)\n```\n\nWe could instead fit a spatiotemporal model by specifying the `time` column and a spatiotemporal structure:\n\n```{r, eval=TRUE, echo=TRUE, warning=FALSE, message=FALSE}\nfit_spatiotemporal \u003c- sdmTMB(\n  density ~ s(depth, k = 5), \n  data = pcod, \n  mesh = mesh,\n  time = \"year\",\n  family = tweedie(link = \"log\"), \n  spatial = \"off\", \n  spatiotemporal = \"ar1\"\n)\n```\n\nIf we wanted to create an area-weighted standardized population index (a time series of abundance accounting for spatial variation in sampling), we could predict on a grid covering the entire survey (`qcs_grid`) with grid cell area 4 km² (2 x 2 km) and pass the predictions to `get_index()`:\n\n```{r plot-index, warning=FALSE, message=FALSE}\ngrid_yrs \u003c- replicate_df(qcs_grid, \"year\", unique(pcod$year))\np_st \u003c- predict(fit_spatiotemporal, newdata = grid_yrs, \n  return_tmb_object = TRUE)\nindex \u003c- get_index(p_st, area = rep(4, nrow(grid_yrs)))\nggplot(index, aes(year, est)) +\n  geom_ribbon(aes(ymin = lwr, ymax = upr), fill = \"grey90\") +\n  geom_line(lwd = 1, colour = \"grey30\") +\n  labs(x = \"Year\", y = \"Biomass (kg)\")\n```\n\nOr the center of gravity (mean location of the population, useful for detecting distributional shifts):\n\n```{r plot-cog, message=FALSE, warning=FALSE}\ncog \u003c- get_cog(p_st, format = \"wide\")\nggplot(cog, aes(est_x, est_y, colour = year)) +\n  geom_pointrange(aes(xmin = lwr_x, xmax = upr_x)) +\n  geom_pointrange(aes(ymin = lwr_y, ymax = upr_y)) +\n  scale_colour_viridis_c()\n```\n\nFor more on these basic features, see the vignettes [Intro to modelling with sdmTMB](https://sdmTMB.github.io/sdmTMB/articles/basic-intro.html) and [Index standardization with sdmTMB](https://sdmTMB.github.io/sdmTMB/articles/index-standardization.html). \n\n## Advanced functionality\n\n### Time-varying coefficients\n\nTime-varying coefficients allow parameters to change over time as random walks. This is useful when relationships may shift gradually (e.g., due to environmental change).\n\nTime-varying intercept:\n\n```{r, eval=FALSE}\nfit \u003c- sdmTMB(\n  density ~ 0 + s(depth, k = 5), \n  time_varying = ~ 1, \n  data = pcod, mesh = mesh,\n  time = \"year\",  \n  family = tweedie(link = \"log\"),\n  silent = FALSE # see progress\n)\n```\n\nTime-varying (random walk) effect of depth:\n\n```{r, eval=FALSE}\nfit \u003c- sdmTMB(\n  density ~ 1, \n  time_varying = ~ 0 + depth_scaled + depth_scaled2,\n  data = pcod, mesh = mesh,\n  time = \"year\",\n  family = tweedie(link = \"log\"),\n  spatial = \"off\",\n  spatiotemporal = \"ar1\",\n  silent = FALSE\n)\n```\n\nSee the vignette [Intro to modelling with sdmTMB](https://sdmTMB.github.io/sdmTMB/articles/basic-intro.html) for more details.\n\n### Spatially varying coefficients (SVC)\n\nSpatially varying coefficients allow the effect of a predictor to differ across space, revealing spatial heterogeneity in relationships (e.g., trends that are positive in some areas and negative in others).\n\nSpatially varying effect of time:\n\n```{r, eval=TRUE, warning=FALSE}\npcod$year_scaled \u003c- as.numeric(scale(pcod$year))\nfit \u003c- sdmTMB(\n  density ~ s(depth, k = 5) + year_scaled,\n  spatial_varying = ~ year_scaled, \n  data = pcod, mesh = mesh, \n  time = \"year\",\n  family = tweedie(link = \"log\"),\n  spatiotemporal = \"off\"\n)\n```\n\nSee `zeta_s` in the output, which represents spatial variation in the coefficient. Ensure the SVC covariate is centered (mean ≈ 0) and include it in the main formula too so that `zeta_s` represents deviations from the average effect.\n\n```{r plot-zeta}\ngrid_yrs \u003c- replicate_df(qcs_grid, \"year\", unique(pcod$year))\ngrid_yrs$year_scaled \u003c- (grid_yrs$year - mean(pcod$year)) / sd(pcod$year)\np \u003c- predict(fit, newdata = grid_yrs) %\u003e% \n  subset(year == 2011) # any year\nggplot(p, aes(X, Y, fill = zeta_s_year_scaled)) + geom_raster() +\n  scale_fill_gradient2()\n```\n\nSee the vignette on [Fitting spatial trend models with sdmTMB](https://sdmTMB.github.io/sdmTMB/articles/spatial-trend-models.html) for more details.\n\n### Random intercepts\n\nWe can use the same syntax (`1 | group`) as lme4 or glmmTMB to fit random intercepts:\n\n```{r, eval=FALSE, echo=TRUE, warning=FALSE, message=FALSE}\npcod$year_factor \u003c- as.factor(pcod$year)\nfit \u003c- sdmTMB(\n  density ~ s(depth, k = 5) + (1 | year_factor),\n  data = pcod, mesh = mesh,\n  time = \"year\",\n  family = tweedie(link = \"log\")\n)\n```\n\n### Breakpoint and threshold effects\n\n```{r, eval=FALSE}\nfit \u003c- sdmTMB(\n  present ~ 1 + breakpt(depth_scaled), \n  data = pcod, mesh = mesh,\n  family = binomial(link = \"logit\")\n)\n```\n\n```{r, eval=FALSE}\nfit \u003c- sdmTMB(\n  present ~ 1 + logistic(depth_scaled), \n  data = pcod, mesh = mesh,\n  family = binomial(link = \"logit\")\n)\n```\n\nSee the vignette on [Threshold modeling with sdmTMB](https://sdmTMB.github.io/sdmTMB/articles/threshold-models.html) for more details.\n\n### Simulating data\n\n#### Simulating data from scratch\n\n```{r}\npredictor_dat \u003c- expand.grid(\n  X = seq(0, 1, length.out = 100), Y = seq(0, 1, length.out = 100)\n)\nmesh \u003c- make_mesh(predictor_dat, xy_cols = c(\"X\", \"Y\"), cutoff = 0.05)\nsim_dat \u003c- sdmTMB_simulate(\n  formula = ~ 1,\n  data = predictor_dat,\n  mesh = mesh,\n  family = poisson(link = \"log\"),\n  range = 0.3,\n  sigma_O = 0.4,\n  seed = 1,\n  B = 1 # B0 = intercept\n)\nhead(sim_dat)\n\n# sample 200 points for fitting:\nset.seed(1)\nsim_dat_obs \u003c- sim_dat[sample(seq_len(nrow(sim_dat)), 200), ]\n```\n\n```{r plot-sim-dat}\nggplot(sim_dat, aes(X, Y)) +\n  geom_raster(aes(fill = exp(eta))) + # mean without observation error\n  geom_point(aes(size = observed), data = sim_dat_obs, pch = 21) +\n  scale_fill_viridis_c() +\n  scale_size_area() +\n  coord_cartesian(expand = FALSE)\n```\n\nFit to the simulated data:\n\n```{r}\nmesh \u003c- make_mesh(sim_dat_obs, xy_cols = c(\"X\", \"Y\"), cutoff = 0.05)\nfit \u003c- sdmTMB(\n  observed ~ 1,\n  data = sim_dat_obs,\n  mesh = mesh,\n  family = poisson()\n)\n```\n\nSee [`?sdmTMB_simulate`](https://sdmTMB.github.io/sdmTMB/reference/sdmTMB_simulate.html) for more details.\n\n#### Simulating from an existing fit\n\n```{r sim, include=FALSE, eval=FALSE}\ns \u003c- simulate(fit, nsim = 500)\ndim(s)\ns[1:3,1:4]\n```\n\n``` r\ns \u003c- simulate(fit, nsim = 500)\ndim(s)\n#\u003e [1] 969 500\ns[1:3,1:4]\n#\u003e      [,1]     [,2]     [,3]     [,4]\n#\u003e [1,]    0 59.40310 83.20888  0.00000\n#\u003e [2,]    0 34.56408  0.00000 19.99839\n#\u003e [3,]    0  0.00000  0.00000  0.00000\n```\n\nSee the vignette on [Residual checking with sdmTMB](https://sdmTMB.github.io/sdmTMB/articles/residual-checking.html),  [`?simulate.sdmTMB`](https://sdmTMB.github.io/sdmTMB/reference/simulate.sdmTMB.html), and [`?dharma_residuals`](https://sdmTMB.github.io/sdmTMB/reference/dharma_residuals.html) for more details.\n\n### Sampling from the joint precision matrix\n\nWe can take samples from the implied parameter distribution assuming an MVN covariance matrix on the internal parameterization:\n\n```{r plot-mvn}\nsamps \u003c- gather_sims(fit, nsim = 1000)\nggplot(samps, aes(.value)) + geom_histogram() +\n  facet_wrap(~.variable, scales = \"free_x\")\n```\n\nSee [`?gather_sims`](https://sdmTMB.github.io/sdmTMB/reference/gather_sims.html) and [`?get_index_sims`](https://sdmTMB.github.io/sdmTMB/reference/get_index_sims.html) for more details.\n\n### Calculating uncertainty on spatial predictions\n\nThe fastest way to get point-wise prediction uncertainty is to use the MVN samples:\n\n```{r plot-pred-mvn}\np \u003c- predict(fit, newdata = predictor_dat, nsim = 500)\npredictor_dat$se \u003c- apply(p, 1, sd)\nggplot(predictor_dat, aes(X, Y, fill = se)) +\n  geom_raster() +\n  scale_fill_viridis_c(option = \"A\") +\n  coord_cartesian(expand = FALSE)\n```\n\n### Cross validation\n\nsdmTMB has built-in functionality for cross-validation. If we were to set a `future::plan()`, the folds would be fit in parallel:\n\n```{r cv, warning=FALSE}\nmesh \u003c- make_mesh(pcod, c(\"X\", \"Y\"), cutoff = 10)\n## Set parallel processing if desired:\n# library(future)\n# plan(multisession)\nm_cv \u003c- sdmTMB_cv(\n  density ~ s(depth, k = 5),\n  data = pcod, mesh = mesh,\n  family = tweedie(link = \"log\"), k_folds = 2\n)\n# Sum of log likelihoods of left-out data:\nm_cv$sum_loglik\n```\n\nSee [`?sdmTMB_cv`](https://sdmTMB.github.io/sdmTMB/reference/sdmTMB_cv.html) for more details.\n\n### Priors\n\nPriors/penalties can be placed on most parameters. For example, here we place a PC (penalized complexity) prior on the Matérn random field parameters, a standard normal prior on the effect of depth, a Normal(0, 10^2) prior on the intercept, and a half-normal prior on the Tweedie dispersion parameter (`phi`):\n\n```{r priors}\nmesh \u003c- make_mesh(pcod, c(\"X\", \"Y\"), cutoff = 10)\nfit \u003c- sdmTMB(\n  density ~ depth_scaled,\n  data = pcod, mesh = mesh,\n  family = tweedie(),\n  priors = sdmTMBpriors(\n    matern_s = pc_matern(range_gt = 10, sigma_lt = 5),\n    b = normal(c(0, 0), c(1, 10)),\n    phi = halfnormal(0, 15)\n  )\n)\n```\n\nWe can visualize the PC Matérn prior:\n\n```{r plot-pc-matern}\nplot_pc_matern(range_gt = 10, sigma_lt = 5)\n```\n\nSee [`?sdmTMBpriors`](https://sdmTMB.github.io/sdmTMB/reference/priors.html) for more details.\n\n### Bayesian MCMC sampling with Stan\n\nThe fitted model can be passed to the tmbstan package to sample from the posterior with Stan. See the [Bayesian vignette](https://sdmTMB.github.io/sdmTMB/articles/bayesian.html).\n\n### Turning off random fields\n\nWe can turn off the random fields for model comparison:\n\n```{r no-rf, warning=FALSE, message=FALSE}\nfit_sdmTMB \u003c- sdmTMB(\n  present ~ poly(depth_scaled, 2),\n  data = pcod, mesh = mesh,\n  spatial = \"off\",\n  family = binomial()\n)\nfit_glm \u003c- glm(\n  present ~ poly(depth_scaled, 2),\n  data = pcod,\n  family = binomial()\n)\n\ntidy(fit_sdmTMB)\nbroom::tidy(fit_glm)\n```\n\n### Using a custom fmesher mesh\n\nDefining a mesh directly with INLA:\n\n```{r inla-mesh, warning=FALSE, fig.asp = 1, dpi = 40, out.width = \"30%\"}\nbnd \u003c- INLA::inla.nonconvex.hull(cbind(pcod$X, pcod$Y), convex = -0.1)\nmesh_inla \u003c- INLA::inla.mesh.2d(\n  boundary = bnd,\n  max.edge = c(25, 50)\n)\nmesh \u003c- make_mesh(pcod, c(\"X\", \"Y\"), mesh = mesh_inla)\nplot(mesh)\n```\n\n```{r inla-mesh2, eval=FALSE}\nfit \u003c- sdmTMB(\n  density ~ s(depth, k = 5),\n  data = pcod, mesh = mesh,\n  family = tweedie(link = \"log\")\n)\n```\n\n### Barrier meshes\n\nA barrier mesh limits correlation across barriers (e.g., land or water). See `add_barrier_mesh()` in [sdmTMBextra](https://github.com/sdmTMB/sdmTMBextra).\n\n## Related software\n\nsdmTMB is heavily inspired by the [VAST](https://github.com/James-Thorson-NOAA/VAST) and the [glmmTMB](https://github.com/glmmTMB/glmmTMB) R packages.\n\nThe newer [tinyVAST](https://github.com/vast-lib/tinyVAST) R package can fit many of the models that VAST and sdmTMB can with an interface similar to sdmTMB. Generally, we recommend tinyVAST for multivariate applications or for (dynamic) structural equation modelling with optional spatial and/or spatiotemporal components.\n\n[INLA](https://www.r-inla.org/) and [inlabru](https://sites.google.com/inlabru.org/inlabru) can fit many of the same models as sdmTMB (and more) in an approximate Bayesian inference framework.\n\n[mgcv](https://cran.r-project.org/package=mgcv) can fit similar SPDE-based Gaussian Markov random field models with code included in [Miller et al. (2019)](https://doi.org/10.1007/s13253-019-00377-z), but this will be slower for large spatial datasets.\n\nA table in the [sdmTMB preprint](https://doi.org/10.1101/2022.03.24.485545) describes functionality and timing comparisons between sdmTMB, VAST, INLA/inlabru, and mgcv and the discussion makes suggestions about when you might choose one package over another.\n","funding_links":[],"readme_doi_urls":["https://doi.org/10.1111/j.1467-9868.2011.00777.x);","https://doi.org/10.1101/2022.03.24.485545","https://doi.org/10.18637/jss.v115.i02","https://doi.org/10.1007/s13253-019-00377-z"],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":["fisheries","climate","energy-system","ecological-modelling","tidyverse","fisheries-stock-assessment","stock-synthesis","extremes","spatiotemporal"],"project_url":"https://ost.ecosyste.ms/api/v1/projects/11969","html_url":"https://ost.ecosyste.ms/projects/11969"}