Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vignette edits #170

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ export(make_love_plot)
export(trimWeights)
import(ggplot2)
import(stats)
import(utils)
importFrom(survey,svyglm)
Binary file added data/sim_data_long_miss_bin.rda
Binary file not shown.
Binary file modified data/sim_data_wide.rda
Binary file not shown.
Binary file added data/sim_data_wide_bin.rda
Binary file not shown.
Binary file modified data/sim_data_wide_miss.rda
Binary file not shown.
Binary file added data/sim_data_wide_miss_bin.rda
Binary file not shown.
7 changes: 5 additions & 2 deletions examplePipelineRevised.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ data <- data_wide

#optional; number of imputations (default is 5)
m <- NA
m <- 5 #empirical example
m <- 1 #empirical example

#optional; provide an imputation method pmm, midastouch, sample, cart , rf (default)
method <- NA
Expand All @@ -214,7 +214,10 @@ imputed_data <- imputeData(data = data_wide, exposure = exposure, outcome = outc
#if you want to use the package with imputed data
data <- imputed_data


```


```{r}

#OR, read in a saved mids object
imputed_data <- readRDS("/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/testing data/continuous outcome/continuous exposure/FLP_wide_imputed_mids.rds") # final imputations for empirical example; place your .rds file in your home directory and change the name of file here
Expand Down
4 changes: 2 additions & 2 deletions vignettes/Data_Requirements.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ We advise the user to specify and include in the dataset any time invariant and

The following longitudinal data that accompany *devMSMs* are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008).

*devMSMs* requires data in wide format (i.e., one row per individual, with and “ID” column for identifiers), in one of three ways:
*devMSMs* (see *Workflows* vignettes) requires complete data in wide format (i.e., one row per individual, with and “ID” column for identifiers), in one of three ways:

(1) a data frame with no missing data;
(1) a single data frame with no missing data;

```{r}
data("sim_data_wide", package = "devMSMs")
Expand Down
9 changes: 6 additions & 3 deletions vignettes/Preliminary_Steps.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ knitr::opts_chunk$set(

options(rmarkdown.html_vignette.check_title = FALSE)
```

<br>

These four recommended preliminary steps are designed to assist the user in preparing and inspecting their data to ensure appropriate use of the package. Users should first view the <a href="https://istallworthy.github.io/devMSMs/articles/Terminology.html">Terminology</a> vignette and complete the Data Requirements and <a href="https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html">Specifying Core Inputs</a> vignettes. The following recommended preliminary steps (using helper functions summarized in Table 1 are not included in the *devMSMs* package that can be found at the following <a href="https://github.com/istallworthy/devMSMsHelpers">Github</a> are designed to assist the user in preparing and inspecting their data and guide specification of required function inputs to ensure appropriate use of the package. Of note, *devMSMs* must also be installed and loaded to use these helper functions (see <a href="https://istallworthy.github.io/devMSMs/">Installation</a>).


These four recommended preliminary steps are designed to assist the user in preparing and inspecting their data to ensure appropriate use of the package. Users should first view the <a href="https://istallworthy.github.io/devMSMs/articles/Terminology.html">Terminology</a> vignette and complete the <a href="https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html">Data Requirements</a> and <a href="https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html">Specifying Core Inputs</a> vignettes.

The following recommended preliminary steps (using helper functions summarized in Table 1 are not included in the *devMSMs* package that can be found at the following <a href="https://github.com/istallworthy/devMSMsHelpers">Github</a> are designed to assist the user in preparing and inspecting their data and guide specification of required function inputs to ensure appropriate use of the package. Of note, *devMSMs* must also be installed and loaded to use these helper functions (see <a href="https://istallworthy.github.io/devMSMs/">Installation</a>).

The user who has already formatted their data in wide format according to the Data Requirements vignette and imputed to accommodate any missing data (P2), can focus only on subsections P3 Identifying Optional Exposure Epochs and P4 Verifying History Distributions prior to using the package. Following completion of this vignette, users should use one of the Workflows vignettes to implement *devMSMs* with their longitudinal data.


Expand Down
5 changes: 4 additions & 1 deletion vignettes/Specify_Core_Inputs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ knitr::opts_chunk$set(
)
```

This vignette guides users through the specification of the core inputs required by the *deMSMs* functions (and helper functions). Users should first view the <a href="https://istallworthy.github.io/devMSMs/articles/Terminology.html">Terminology</a> and Data Requirements vignettes. This vignette helps users specify core inputs (e.g., home directory, exposure, exposure time points, time-varying confounders, time invariant confounders, outcome, reference, comparison, high/low cutoff for continuous exposure, and balance threshold) that are used by multiple functions in the *devMSMs* package (see *Workflows* vignettes). Their use and values should be kept consistent throughout the package. Additionally, all functions have two optional inputs allowing the user to override defaults to suppress all messaging to the console (`verbose = FALSE`) and elect not to save out locally any intermediate and final output (`save.out = FALSE`).
This vignette guides users through the specification of the core inputs required by the *deMSMs* functions (and helper functions). Users should first view the <a href="https://istallworthy.github.io/devMSMs/articles/Terminology.html">Terminology</a> and <a href="https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html">Data Requirements</a> vignettes. This vignette helps users specify core inputs (e.g., home directory, exposure, exposure time points, time-varying confounders, time invariant confounders, outcome, reference, comparison, high/low cutoff for continuous exposure, and balance threshold) that are used by multiple functions in the *devMSMs* package (see *Workflows* vignettes). Their use and values should be kept consistent throughout the package. Additionally, all functions have two optional inputs allowing the user to override defaults to suppress all messaging to the console (`verbose = FALSE`) and elect not to save out locally any intermediate and final output (`save.out = FALSE`).

Following completion of this vignette, the user should complete the <a href="https://istallworthy.github.io/devMSMs/articles/Preliminary_Steps.html">Preliminary Steps</a> followed by a *Workflow* vignette to implement *devMSMs* with their longitudinal data.

Expand All @@ -35,6 +35,7 @@ Users are required to specify home directory, or in quotations, a path to a desi
home_dir <- NA
home_dir <- '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa' #note: no / after
```

<br>

### Exposure Variable
Expand All @@ -43,6 +44,7 @@ Users are required to specify an exposure variable as input to all functions in
```{r}
exposure <- "ESETA1"
```

<br>

### Exposure Time Points
Expand Down Expand Up @@ -108,6 +110,7 @@ tv_confounders <- c("SAAmylase.6","SAAmylase.15", "SAAmylase.24",
"fscore.35", "fscore.58"
)
```

<br>

### References
Expand Down
6 changes: 4 additions & 2 deletions vignettes/Workflow_Continuous_Exposure.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ library(devMSMsHelpers)
```
<br>

This vignette guides a user through the process of using *devMSMs* with a continuously distributed exposure variable. The users should first view the <a href="https://istallworthy.github.io/devMSMs/articles/Terminology.html">Terminology</a>, Data Requirements, <a href="https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html">Specifying Core Inputs</a>, and <a href="https://istallworthy.github.io/devMSMs/articles/Preliminary_Steps.html">Preliminary Steps</a> vignettes.
This vignette guides a user through the process of using *devMSMs* to fit marginal structural models (MSMs) with a a continuously distributed exposure variable. The users should first view the <a href="https://istallworthy.github.io/devMSMs/articles/Terminology.html">Terminology</a>, <a href="https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html">Data Requirements</a>, <a href="https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html">Specifying Core Inputs</a>, and <a href="https://istallworthy.github.io/devMSMs/articles/Preliminary_Steps.html">Preliminary Steps</a> vignettes.

The following suggested workflow and constituent steps are also reflected in <a href="https://github.com/istallworthy/devMSMs/blob/main/examplePipelineRevised.Rmd">examplePipeline.rmd file</a>. This workflow is designed to complement the conceptual and high-level practical details provided in the manuscript *[add link here]*. We strongly suggest users familiarize themselves with concepts of the MSM process outlined in the manuscript and the practical steps and functions put forth in the following sections before implementing this workflow.
The following suggested workflow and constituent steps are also reflected in <a href="https://github.com/istallworthy/devMSMs/blob/main/examplePipelineRevised.Rmd">examplePipeline.rmd file</a>. This workflow is designed to complement the conceptual and high-level practical details provided in the manuscript *[add link here]*. We strongly suggest users familiarize themselves with concepts of the MSM process outlined in the manuscript and the practical steps and functions put forth in the following sections before implementing this workflow.

All *devMSMs* functions have optional arguments to suppress saving output locally (`save.out = FALSE`) and printing it to the console (`verbose = FALSE`). The defaults to both arguments are TRUE, as recommended for use of the package's full functionality. Users must supply a path to a home directory (`home_dir`) if `save.out = TRUE`. All sub-folders referenced by each function are created automatically within the home directory.

Expand All @@ -45,6 +45,7 @@ save.out = FALSE

verbose = TRUE
```

<br>

### Load data
Expand Down Expand Up @@ -96,6 +97,7 @@ ti_confounders <- c("state", "BioDadInHH2", "PmAge2", "PmBlac2", "TcBlac2", "PmM
"peri_health", "caregiv_health", "gov_assist"
)
```

<br>

## Phase 1: Confounder Adjustment
Expand Down
Loading