Skip to content

Commit

Permalink
Website configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoYan-Clarence committed Jun 27, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent a9b450d commit 18ac3ce
Showing 19 changed files with 203 additions and 133 deletions.
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
50 changes: 50 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ Imports:
MCMCpack,
doParallel,
foreach,
parallel,
R2jags,
coda (>= 0.19-4)
License: MIT + file LICENSE
Encoding: UTF-8
@@ -18,5 +20,6 @@ Suggests:
rmarkdown,
testthat (>= 3.0.0)
Config/testthat/edition: 3
Description: This package provides tools for estimating causal effects using Bayesian Marginal Structural Models. It includes functions for Bayesian non-parametric bootstrap to calculate causal effects and for plotting the average potential outcome (APO). The package aims to facilitate the analysis of observational data with time-varying treatments, providing a user-friendly software to Bayesian causal inference methods.
Description: This package provides tools for estimating causal effects using Bayesian Marginal Structural Models. It includes functions for estimating Bayesian weights using JAGS and for Bayesian non-parametric bootstrap to calculate causal effects.
VignetteBuilder: knitr
URL: https://kuan-liu-lab.github.io/bayesmsm/
2 changes: 1 addition & 1 deletion R/summary.bayesmsm.R
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
#'
#' @param model A model object from bayesmsm
#'
#' @return
#' @return A summary table of the results from bayesmsm.
#' @export
#'
#' @examples
79 changes: 74 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@

[![pkgdown](https://img.shields.io/badge/pkgdown--blue)](https://Kuan-Liu-Lab.github.io/bayesmsm/)

The `bayesmsm` package is an R package for implementing Bayesian marginal structural models.
This package provides tools for estimating causal effects using Bayesian Marginal Structural Models. It includes functions for estimating Bayesian weights using JAGS and for Bayesian non-parametric bootstrap to calculate causal effects.


# Reference

@@ -11,21 +12,89 @@ Reference paper on Bayesian marginal structural models:
- Saarela, O., Stephens, D. A., Moodie, E. E., & Klein, M. B. (2015). On Bayesian estimation of marginal structural models. Biometrics, 71(2), 279-288.

- Liu, K., Saarela, O., Feldman, B. M., & Pullenayegum, E. (2020). Estimation of causal effects with repeatedly measured outcomes in a Bayesian framework. Statistical methods in medical research, 29(9), 2507-2519.


# Installation
install using `devtools` package
```

Install using `devtools` package:

```r
## install.packages(devtools) ## make sure to have devtools installed
devtools::install_github("Kuan-Liu-Lab/bayesmsm")
library(bayesmsm)
```

# Dependency


This package depends on the following R packages:
- `MCMCpack`
- `doParallel`
- `foreach`
- `parallel`
- `R2jags`
- `coda`


# Examples

Here are some examples demonstrating how to use the `bayesmsm` package:

```r
# Load example data
testdata <- read.csv(system.file("extdata", "continuous_outcome_data.csv", package = "bayesmsm"))

# Calculate Bayesian weights
weights <- bayesweight(
trtmodel.list = list(
a_1 ~ w1 + w2 + L1_1 + L2_1,
a_2 ~ w1 + w2 + L1_1 + L2_1 + L1_2 + L2_2 + a_1
),
data = testdata,
n.iter = 250,
n.burnin = 150,
n.thin = 5,
n.chains = 2,
seed = 890123,
parallel = TRUE
)

# Perform Bayesian non-parametric bootstrap
model <- bayesmsm(
ymodel = y ~ a_1 + a_2,
nvisit = 2,
reference = c(rep(0, 2)),
comparator = c(rep(1, 2)),
family = "gaussian",
data = testdata,
wmean = weights,
nboot = 1000,
optim_method = "BFGS",
seed = 890123,
parallel = TRUE,
ncore = 2
)

# View model summary
summary.bayesmsm(model)
```


# Documentation

For comprehensive documentation and examples, visit the [pkgdown website](https://Kuan-Liu-Lab.github.io/bayesmsm/).


# License

This package is licensed under the MIT License. See the LICENSE file for details.


# Citation

If you use the `bayesmsm` package in your research, please cite the reference papers listed above.


# Developers

- Kuan Liu
- Xiao Yan (Maintainer)
10 changes: 4 additions & 6 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
pkgdown:
title: bayesmsm
destination: docs

template:
bootstrap: 5
bootswatch: flatly

navbar:
structure:
left:
- home
- reference
- articles
left:
- text: "Home"
- text: Home
href: index.html
- text: "Reference"
- text: Reference
href: reference/index.html
- text: "Articles"
- text: Articles
href: articles/index.html
url: https://kuan-liu-lab.github.io/bayesmsm/

url: https://Kuan-Liu-Lab.github.io/bayesmsm/
7 changes: 0 additions & 7 deletions docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js.map

This file was deleted.

6 changes: 0 additions & 6 deletions docs/deps/bootstrap-5.2.2/bootstrap.min.css

This file was deleted.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ pkgdown: 2.0.8
pkgdown_sha: ~
articles:
vignette: vignette.html
last_built: 2024-06-27T06:24Z
last_built: 2024-06-27T06:32Z
urls:
reference: https://Kuan-Liu-Lab.github.io/bayesmsm/reference
article: https://Kuan-Liu-Lab.github.io/bayesmsm/articles
74 changes: 0 additions & 74 deletions docs/reference/hello.html

This file was deleted.

2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
@@ -30,9 +30,6 @@
<url>
<loc>https://Kuan-Liu-Lab.github.io/bayesmsm/reference/calculate_effect.html</loc>
</url>
<url>
<loc>https://Kuan-Liu-Lab.github.io/bayesmsm/reference/hello.html</loc>
</url>
<url>
<loc>https://Kuan-Liu-Lab.github.io/bayesmsm/reference/index.html</loc>
</url>
16 changes: 15 additions & 1 deletion man/bayesmsm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 18ac3ce

Please sign in to comment.