arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.19082stat.COstat.ME
收藏

Gratia:一个用于探索广义可加模型的 R 包

Gratia: An R package for exploring generalized additive models

Gavin L. Simpson

AI总结:

Gratia 是基于 mgcv 的 R 包,通过提供整洁的 ggplot2 绘图、模型诊断和后验分布抽样等功能,简化了广义可加模型(GAMs)的探索、教学与理解。

摘要:

广义可加模型(GAMs, Hastie & Tibshirani, 1990; Wood, 2017)是广义线性模型的扩展,允许将协变量的效应建模为平滑函数。GAMs 在许多科学领域越来越被广泛使用(例如 Pedersen, Miller, Simpson, & Ross, 2019; Simpson, 2018),因为平滑函数允许通过使用惩罚样条从数据中学习协变量与响应变量之间的非线性关系。在 R(R Core Team, 2024)生态系统中,Simon Wood 的 mgcv 包(Wood, 2017)被广泛用于拟合 GAMs,并且是一个推荐的包,作为默认安装的一部分随 R 一起发布。越来越多的其他 R 包构建于 mgcv 之上,例如作为引擎来拟合 mgcv 本身无法处理的专门模型(例如 GJMR, Marra & Radice, 2023),或者利用 mgcv 中可用的各种样条(例如 brms, Bürkner, 2017)。gratia 包构建于 mgcv 之上,通过提供函数使处理 GAMs 更加容易。gratia 采用整洁的方法(Wickham, 2014),提供 ggplot2(Wickham, 2016)替代 mgcv 基于基础图形的绘图,提供模型诊断和探索拟合模型的函数,以及一系列从拟合的 GAM 的后验分布中抽取样本的函数。还提供了额外的功能以促进 GAMs 的教学和理解。

英文摘要:

Generalized additive models (GAMs, Hastie & Tibshirani, 1990; Wood, 2017) are an extension of the generalized linear model that allows the effects of covariates to be modelled as smooth functions. GAMs are increasingly used in many areas of science (e.g. Pedersen, Miller, Simpson, & Ross, 2019; Simpson, 2018) because the smooth functions allow nonlinear relationships between covariates and the response to be learned from the data through the use of penalized splines. Within the R (R Core Team, 2024) ecosystem, Simon Wood's mgcv package (Wood, 2017) is widely used to fit GAMs and is a Recommended package that ships with R as part of the default install. A growing number of other R packages build upon mgcv, for example as an engine to fit specialised models not handled by mgcv itself (e.g. GJMR, Marra & Radice, 2023), or to make use of the wide range of splines available in mgcv (e.g. brms, Bürkner, 2017). The gratia package builds upon mgcv by providing functions that make working with GAMs easier. gratia takes a tidy approach (Wickham, 2014) providing ggplot2 (Wickham, 2016) replacements for mgcv's base graphics-based plots, functions for model diagnostics and exploration of fitted models, and a family of functions for drawing samples from the posterior distribution of a fitted GAM. Additional functionality is provided to facilitate the teaching and understanding of GAMs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑