{"id":22463702,"url":"https://github.com/poissonconsulting/jmbr","last_synced_at":"2025-08-02T05:32:21.400Z","repository":{"id":15487859,"uuid":"77870888","full_name":"poissonconsulting/jmbr","owner":"poissonconsulting","description":"An R package to facilitate analyses using JAGS","archived":false,"fork":false,"pushed_at":"2024-11-24T07:44:39.000Z","size":57005,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-24T08:25:48.666Z","etag":null,"topics":["jags","mbr","rstats"],"latest_commit_sha":null,"homepage":"https://poissonconsulting.github.io/jmbr/","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/poissonconsulting.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","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":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-03T00:26:30.000Z","updated_at":"2024-11-24T07:36:34.000Z","dependencies_parsed_at":"2023-09-30T04:11:00.359Z","dependency_job_id":"742cff58-a723-467e-995b-d4646d6b874d","html_url":"https://github.com/poissonconsulting/jmbr","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fjmbr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fjmbr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fjmbr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fjmbr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poissonconsulting","download_url":"https://codeload.github.com/poissonconsulting/jmbr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228439452,"owners_count":17920026,"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":["jags","mbr","rstats"],"created_at":"2024-12-06T09:13:50.071Z","updated_at":"2024-12-06T09:13:50.160Z","avatar_url":"https://github.com/poissonconsulting.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, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"tools/README-\"\n)\n```\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[![R-CMD-check](https://github.com/poissonconsulting/jmbr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/poissonconsulting/jmbr/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/poissonconsulting/jmbr/branch/master/graph/badge.svg)](https://codecov.io/gh/poissonconsulting/jmbr?branch=master)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/mit/)\n\u003c!-- badges: end --\u003e\n\n# jmbr\n\n## Introduction\n\n`jmbr` (pronounced jimber) is an R package to facilitate analyses using Just Another Gibbs Sampler ([`JAGS`](http://mcmc-jags.sourceforge.net)).\n\nIt is part of the [mbr](https://github.com/poissonconsulting/mbr) family of packages.\n\n## Demonstration\n\n```{r, message = FALSE}\nlibrary(jmbr)\nlibrary(mbr)\n```\n\n```{r}\n# define model in JAGS language\nmodel \u003c- model(\"model {\n  alpha ~ dnorm(0, 10^-2)\n  beta1 ~ dnorm(0, 10^-2)\n  beta2 ~ dnorm(0, 10^-2)\n  beta3 ~ dnorm(0, 10^-2)\n\n  log_sAnnual ~ dnorm(0, 10^-2)\n  log(sAnnual) \u003c- log_sAnnual\n\n  for(i in 1:nAnnual) {\n    bAnnual[i] ~ dnorm(0, sAnnual^-2)\n  }\n\n  for (i in 1:length(Pairs)) {\n    log(ePairs[i]) \u003c- alpha + beta1 * Year[i] + beta2 * Year[i]^2 + beta3 * Year[i]^3 + bAnnual[Annual[i]]\n    Pairs[i] ~ dpois(ePairs[i])\n  }\n}\")\n\n# add R code to calculate derived parameters\nmodel \u003c- update_model(model, new_expr = \"\nfor (i in 1:length(Pairs)) {\n  log(prediction[i]) \u003c- alpha + beta1 * Year[i] + beta2 * Year[i]^2 + beta3 * Year[i]^3 + bAnnual[Annual[i]]\n}\")\n\n# define data types and center year\nmodel \u003c- update_model(model,\n  select_data = list(\"Pairs\" = integer(), \"Year*\" = integer(), Annual = factor()),\n  derived = \"sAnnual\",\n  random_effects = list(bAnnual = \"Annual\")\n)\n\ndata \u003c- bauw::peregrine\ndata$Annual \u003c- factor(data$Year)\n\nset_analysis_mode(\"report\")\n\n# analyse\nanalysis \u003c- analyse(model, data = data)\nanalysis \u003c- reanalyse(analysis)\n\ncoef(analysis, simplify = TRUE)\n\nplot(analysis)\n```\n\n```{r, message = FALSE}\n# make predictions by varying year with other predictors including the random effect of Annual held constant\nyear \u003c- predict(analysis, new_data = \"Year\")\n\n# plot those predictions\nlibrary(ggplot2)\n\nggplot(data = year, aes(x = Year, y = estimate)) +\n  geom_point(data = bauw::peregrine, aes(y = Pairs)) +\n  geom_line() +\n  geom_line(aes(y = lower), linetype = \"dotted\") +\n  geom_line(aes(y = upper), linetype = \"dotted\") +\n  expand_limits(y = 0)\n```\n\n## Installation\n\nTo install from GitHub\n```\ninstall.packages(\"devtools\")\ndevtools::install_github(\"poissonconsulting/jmbr\")\n```\n\n## Citation\n\n```{r, comment=\"\", echo=FALSE}\ncitation(package = \"jmbr\")\n```\n\n## Contribution\n\nPlease report any [issues](https://github.com/poissonconsulting/jmbr/issues).\n\n[Pull requests](https://github.com/poissonconsulting/jmbr/pulls) are always welcome.\n\n## Code of Conduct\n\nPlease note that the jmbr 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\n## Inspiration\n\n- [jaggernaut](https://github.com/poissonconsulting/jaggernaut)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoissonconsulting%2Fjmbr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoissonconsulting%2Fjmbr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoissonconsulting%2Fjmbr/lists"}