{"id":15801067,"url":"https://github.com/sempwn/gamdiffs","last_synced_at":"2025-03-31T21:30:09.316Z","repository":{"id":42016373,"uuid":"498932472","full_name":"sempwn/gamdiffs","owner":"sempwn","description":"Estimation of confidence intervals for GAMs","archived":false,"fork":false,"pushed_at":"2022-11-18T22:04:46.000Z","size":129,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-12T01:23:02.018Z","etag":null,"topics":["r","r-package","rstats"],"latest_commit_sha":null,"homepage":"https://sempwn.github.io/gamdiffs/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sempwn.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-01T23:51:40.000Z","updated_at":"2023-06-22T21:02:05.000Z","dependencies_parsed_at":"2023-01-21T21:49:45.778Z","dependency_job_id":null,"html_url":"https://github.com/sempwn/gamdiffs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sempwn%2Fgamdiffs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sempwn%2Fgamdiffs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sempwn%2Fgamdiffs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sempwn%2Fgamdiffs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sempwn","download_url":"https://codeload.github.com/sempwn/gamdiffs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246544092,"owners_count":20794453,"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"}},"keywords":["r","r-package","rstats"],"created_at":"2024-10-05T01:09:23.057Z","updated_at":"2025-03-31T21:30:09.277Z","avatar_url":"https://github.com/sempwn.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\noptions(scipen = 1, digits = 2)\n```\n\n# gamdiffs\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n[![CRAN status](https://www.r-pkg.org/badges/version/gamdiffs)](https://CRAN.R-project.org/package=gamdiffs)\n[![R-CMD-check](https://github.com/sempwn/gamdiffs/workflows/R-CMD-check/badge.svg)](https://github.com/sempwn/gamdiffs/actions)\n\u003c!-- badges: end --\u003e\n\nThe goal of gamdiffs is to provide a set of convenience functions for the estimation\nand associated standard errors / confidence intervals for a range of Generalized\nAdditive Models. The particular motivation is to provide tools for estimating the \ndifference in outcome under certain counterfactual scenarios for models relevant\nto population public health.\n\nCurrent implemented confidence interval estimates are\n\n* delta method\n* posterior sampling\n* Efron bootstrap sampling\n\n\n## Installation\n\nYou can install the released version of gamdiffs from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"gamdiffs\")\n```\n\nAnd the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"sempwn/gamdiffs\")\n```\n## Example\n\nThis basic example generates some data and fit a thin-plate spline to a time\nvariable (`x`) with outcome `y` which is Poisson-distributed. The sum of the outcome\nbetween time 0 to 20 is then compared to the outcome between time 21 to time 40 \nand the resulting expected difference with associated confidence intervals is \nprovided\n\n```{r example}\nlibrary(gamdiffs)\nlibrary(mgcv)\n## basic usage\nres \u003c- gamdiffs:::create_random_data()\nm \u003c- mgcv::gam(y ~ s(x), data = res, family = poisson)\nbaseline_data \u003c- dplyr::tibble(x = 0:20)\ncounter_data \u003c- dplyr::tibble(x = 21:40)\ntest_diffs \u003c- calc_sum_counterfactual_gam(m, baseline_data,\n  counter_data = counter_data,\n  ci = 0.95\n)\n```\n\nThe resulting expected sum difference between the `baseline_data` and `counter_data`\nare\n\n```{r print result}\nprint(test_diffs)\n```\n\nThe default setting is to estimate the confidence interval from the delta \nmethod. The resulting confidence interval from sampling of the posterior (with\nimproper priors) can be calculated as\n\n```{r example 2}\n\npost_diffs \u003c- calc_sum_counterfactual_gam(m, \n  baseline_data,\n  use_post = TRUE,\n  nrep = 1000,\n  counter_data = counter_data,\n  ci = 0.95\n)\nprint(post_diffs)\n```\n\n\n## Code of Conduct\n  \n  Please note that the gamdiffs project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsempwn%2Fgamdiffs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsempwn%2Fgamdiffs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsempwn%2Fgamdiffs/lists"}