{"id":32209473,"url":"https://github.com/biometris/lmmsolver","last_synced_at":"2026-02-23T05:02:22.014Z","repository":{"id":38745993,"uuid":"420122783","full_name":"Biometris/LMMsolver","owner":"Biometris","description":"See https://biometris.github.io/LMMsolver for a full description","archived":false,"fork":false,"pushed_at":"2025-09-28T20:49:08.000Z","size":39291,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-28T21:14:30.593Z","etag":null,"topics":["cran","mixed-models","r-package","splines"],"latest_commit_sha":null,"homepage":"https://biometris.github.io/LMMsolver","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/Biometris.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":"2021-10-22T14:07:38.000Z","updated_at":"2025-08-25T18:18:16.000Z","dependencies_parsed_at":"2023-12-06T11:10:18.191Z","dependency_job_id":"ba48b273-2d1f-4059-9e91-d97d0b2cc037","html_url":"https://github.com/Biometris/LMMsolver","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/Biometris/LMMsolver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biometris%2FLMMsolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biometris%2FLMMsolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biometris%2FLMMsolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biometris%2FLMMsolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Biometris","download_url":"https://codeload.github.com/Biometris/LMMsolver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biometris%2FLMMsolver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280389470,"owners_count":26322539,"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","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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"}},"keywords":["cran","mixed-models","r-package","splines"],"created_at":"2025-10-22T06:07:05.119Z","updated_at":"2025-10-22T06:07:08.434Z","avatar_url":"https://github.com/Biometris.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\r\noutput: github_document\r\nbibliography: ./vignettes/bibliography.bib\r\n---\r\n\r\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\r\n\r\n```{r, include = FALSE}\r\nknitr::opts_chunk$set(\r\n  collapse = TRUE,\r\n  comment = \"#\u003e\",\r\n  fig.path = \"man/figures/README-\",\r\n  out.width = \"70%\"\r\n)\r\n```\r\n\r\n# LMMsolver \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"139\" alt=\"\" /\u003e\r\n\r\n[![](https://www.r-pkg.org/badges/version/LMMsolver)](https://www.r-pkg.org/pkg/LMMsolver)\r\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/LMMsolver)](https://www.r-pkg.org/pkg/LMMsolver)\r\n[![R-CMD-check](https://github.com/Biometris/LMMsolver/workflows/R-CMD-check/badge.svg)](https://github.com/Biometris/LMMsolver/actions?workflow=R-CMD-check)\r\n[![codecov](https://codecov.io/gh/Biometris/LMMsolver/branch/main/graph/badge.svg)](https://app.codecov.io/gh/Biometris/LMMsolver)\r\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14527379.svg)](https://doi.org/10.5281/zenodo.14527379)\r\n\r\nThe aim of the `LMMsolver` package is to provide an efficient and flexible system to estimate variance components using restricted maximum likelihood or REML [@Patterson1971], for models where the mixed model equations are sparse. An important feature of the package is smoothing with P-splines [@Eilers1996]. The sparse mixed model P-splines formulation [@boer2023] is used, which makes the computations fast. The computational advantage of the sparse mixed model formulation is especially clear for two-dimensional smoothing [@boer2023;@carollo2024].\r\n\r\n\u003c!-- The aim of the `LMMsolver` package is to provide an efficient and flexible system to estimate variance components using restricted maximum likelihood or REML [@Patterson1971], for models where the mixed model equations are sparse [@boer2023]. An example of an application is using splines to model spatial [@Rodriguez-Alvarez2018; @Boer2020] or temporal [@Bustos-Korts2019] trends. Another example is mixed model Quantitative Trait Locus (QTL) analysis for multiparental populations, allowing for heterogeneous residual variance and design matrices with Identity-By-Descent (IBD) probabilities [@Li2021]. --\u003e\r\n\r\n## Installation\r\n\r\n* Install from CRAN:\r\n\r\n```{r, eval = FALSE}\r\ninstall.packages(\"LMMsolver\")\r\n```\r\n\r\n* Install latest development version from GitHub (requires [remotes](https://github.com/r-lib/remotes) package):\r\n\r\n```{r, eval = FALSE}\r\nremotes::install_github(\"Biometris/LMMsolver\", ref = \"develop\", dependencies = TRUE)\r\n```\r\n\r\n## Example\r\n\r\nAs an example of the functionality of the package we use the `USprecip` data set in the `spam` package [@Furrer2010].\r\n\r\n```{r USprecip data}\r\nlibrary(LMMsolver)\r\nlibrary(ggplot2)\r\n\r\n## Get precipitation data from spam\r\ndata(USprecip, package = \"spam\")\r\n\r\n## Only use observed data.\r\nUSprecip \u003c- as.data.frame(USprecip)\r\nUSprecip \u003c- USprecip[USprecip$infill == 1, ]\r\nhead(USprecip[, c(1, 2, 4)], 3)\r\n```\r\n\r\nA two-dimensional P-spline can be defined with the `spl2D()` function, with longitude and latitude as covariates, and anomaly (standardized monthly total precipitation) as response variable:\r\n\r\n```{r runobj}\r\nobj1 \u003c- LMMsolve(fixed = anomaly ~ 1,\r\n                 spline = ~spl2D(x1 = lon, x2 = lat, nseg = c(41, 41)),\r\n                 data = USprecip)\r\n```\r\n\r\n\u003c!-- The summary function gives a table with the effective dimensions and the penalty parameters: --\u003e\r\n\r\n\u003c!-- ```{r ED_USprecip} --\u003e\r\n\u003c!-- summary(obj1) --\u003e\r\n\u003c!-- ``` --\u003e\r\n\r\nThe spatial trend for the precipitation can now be plotted on the map of the USA, using the `predict` function of `LMMsolver`: \r\n\r\n```{r Plot_USprecip, fig.alt=\"Precipitation anomaly USA\"}\r\nlon_range \u003c- range(USprecip$lon)\r\nlat_range \u003c- range(USprecip$lat)\r\nnewdat \u003c- expand.grid(lon = seq(lon_range[1], lon_range[2], length = 200),\r\n                      lat = seq(lat_range[1], lat_range[2], length = 300))\r\nplotDat \u003c- predict(obj1, newdata = newdat)\r\n\r\nplotDat \u003c- sf::st_as_sf(plotDat, coords = c(\"lon\", \"lat\"))\r\nusa \u003c- sf::st_as_sf(maps::map(\"usa\", regions = \"main\", plot = FALSE))\r\nsf::st_crs(usa) \u003c- sf::st_crs(plotDat)\r\nintersection \u003c- sf::st_intersects(plotDat, usa)\r\nplotDat \u003c- plotDat[!is.na(as.numeric(intersection)), ]\r\n\r\nggplot(usa) + \r\n  geom_sf(color = NA) +\r\n  geom_tile(data = plotDat, \r\n            mapping = aes(geometry = geometry, fill = ypred), \r\n            linewidth = 0,\r\n            stat = \"sf_coordinates\") +\r\n  scale_fill_gradientn(colors = topo.colors(100))+\r\n  labs(title = \"Precipitation (anomaly)\", \r\n       x = \"Longitude\", y = \"Latitude\") +\r\n  coord_sf() +\r\n  theme(panel.grid = element_blank())\r\n```\r\n\r\nFurther examples can be found in the vignette.\r\n```r\r\nvignette(\"Solving_Linear_Mixed_Models\")\r\n```\r\n\r\n# References\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiometris%2Flmmsolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiometris%2Flmmsolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiometris%2Flmmsolver/lists"}