metagam is an R-package for meta-analysis of generalized additive models (GAMs). Its main application is cases in which raw data are located in multiple locations, and cannot be shared due to ethical or regulatory restrictions. metagam provides functions for removing all individual participant data from from GAMs fitted separately at each location, such that the resulting object can be shared to a central location. Next, metagam provides functions for meta-analysing these fitted GAMs using pointwise meta-analysis, as well as plotting and summary methods for analyzing the meta-analytic fits. The methods implemented are described in Sorensen et al. (2021), extending upon previous works by Schwartz and Zanobetti (2000) and Crippa, Thomas, and Orsini (2018).
Currently, GAMs objects created with the following functions are supported:
This package is under development, so changes to the interface can be expected. Suggestions for improvements and bug reports are warmly welcome, either by filing an Issue or opening a Pull Request.
Install the current release of metagam from CRAN with:
install.packages("metagam")
Install the current development version of metagam
from
GitHub with:
# install.packages("remotes")
::install_github("lifebrain/metagam") remotes
library("metagam")
library("mgcv")
#> Loading required package: nlme
#> This is mgcv 1.8-38. For overview type 'help("mgcv-package")'.
Simulate three datasets and fit a GAM to each of them. Then use
strip_rawdata()
from metagam to remove individual
participant data.
## Set seed for reproducible random numbers
set.seed(8562957)
## Simulate using mgcv::gamSim
<- lapply(1:3, function(x) gamSim(verbose = FALSE))
datasets ## Fit a model to each dataset
<- lapply(datasets, function(dat){
models ## Full gam with mgcv
<- gam(y ~ s(x2, bs = "cr"), data = dat)
full_model ## Strip rawdata
strip_rawdata(full_model)
})
models
now is a list containing three GAMs without
individual participant data. We can then meta-analyze them using
metagam()
.
<- metagam(models)
meta_analysis summary(meta_analysis)
#> Meta-analysis of GAMs from 3 cohorts, using method FE.
#>
#> Smooth terms analyzed: s(x2).
For further documentation and vignettes, please visit the package website.
Please note that the metagam project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.