Skip to content

Commit

Permalink
Updated examples and documentation. *Should* be ready for initial CRA…
Browse files Browse the repository at this point in the history
…N upload.
  • Loading branch information
LukeDuttweiler committed May 14, 2024
1 parent cce15df commit 3e56a92
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 45 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Version: 0.0.1
Authors@R:
person("Luke", "Duttweiler", , "lduttweiler@hsph.harvard.edu", role = c("aut", "cre", 'cph'),
comment = c(ORCID = "0000-0002-0467-995X"))
Description: Implements a Bayesian hierarchical model designed to identify skips in mobiel menstrual cycle self-tracking on mobiel apps. Future developments will allow for the inclusion of covariates affecting cycle mean and regularity, as well as extra information regarding tracking non-adherence. Main methods to be outlined in a forthcoming paper, with alternative models from Li et al. (2022) <doi:10.1093/jamia/ocab182>.
Description: Implements a Bayesian hierarchical model designed to identify skips in mobile menstrual cycle self-tracking on mobile apps. Future developments will allow for the inclusion of covariates affecting cycle mean and regularity, as well as extra information regarding tracking non-adherence. Main methods to be outlined in a forthcoming paper, with alternative models from Li et al. (2022) <doi:10.1093/jamia/ocab182>.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
4 changes: 2 additions & 2 deletions R/diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#' #Simulated data
#' simDat <- skipTrack.simulate(n = 100, skipProb = c(.7, .2, .1))
#'
#' #Run model fit
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 500)
#' #Run model fit (should typically run with much more than 50 reps)
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 50)
#'
#' #Get diagnostics for cijs
#' skipTrack.diagnostics(modFit, 'cijs')
Expand Down
4 changes: 2 additions & 2 deletions R/fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#' #Simulated data
#' simDat <- skipTrack.simulate(n = 100, skipProb = c(.7, .2, .1))
#'
#' #Run model fit
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 500)
#' #Run model fit (should typically run with much more than 50 reps)
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 50)
#' modFit
#'
skipTrack.fit <- function(Y,cluster,
Expand Down
10 changes: 6 additions & 4 deletions R/results.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@
#' #Simulated data
#' simDat <- skipTrack.simulate(n = 100, skipProb = c(.7, .2, .1))
#'
#' #Run model fit
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 500)
#' #Run model fit (should typically run with much more than 50 reps)
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 50)
#' modFit
#'
#' # If using simulated data (which includes access to ground truth):
#' #
#' skipTrack.results(modFit, trueVals = simDat, burnIn = 250)
#' skipTrack.results(modFit, trueVals = simDat, burnIn = 25)
#' #Recommended burnIn with real data is at least 750
#' #
#' # If not using simulated data:
#' #
# skipTrack.results(modFit, burnIn = 250)
#' skipTrack.results(modFit, burnIn = 25)
#' #Recommended burnIn with real data is at least 750
#'
#' @export
skipTrack.results <- function(stFit, trueVals = NULL, burnIn = 750){
Expand Down
27 changes: 14 additions & 13 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#' #Simulated data
#' simDat <- skipTrack.simulate(n = 100, skipProb = c(.7, .2, .1))
#'
#' #Run model fit
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 500)
#' #Run model fit (should typically run with much more than 50 reps)
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 50)
#' plot(modFit)
#'
plot.skipTrack.model <- function(x, ...){
Expand All @@ -35,8 +35,8 @@ plot.skipTrack.model <- function(x, ...){
#' #Simulated data
#' simDat <- skipTrack.simulate(n = 100, skipProb = c(.7, .2, .1))
#'
#' #Run model fit
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 500)
#' #Run model fit (should typically run with much more than 50 reps)
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 50)
#' print(modFit)
#'
#'
Expand All @@ -58,7 +58,8 @@ print.skipTrack.model <- function(x, ...){

#' Report skipTrack.model structure to console
#'
#' @param x skipTrack.model object from the function skipTrack.fit
#' @param object skipTrack.model object from the function skipTrack.fit
#' @param ... To match other str calls
#'
#' @return Invisible NULL. Prints structure of skipTrack.model object
#' @export
Expand All @@ -67,15 +68,15 @@ print.skipTrack.model <- function(x, ...){
#' #Simulated data
#' simDat <- skipTrack.simulate(n = 100, skipProb = c(.7, .2, .1))
#'
#' #Run model fit
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 500)
#' #Run model fit (should typically run with much more than 50 reps)
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 50)
#' str(modFit)
#'
#'
str.skipTrack.model <- function(x){
str.skipTrack.model <- function(object, ...){
cat(paste0('skipTrack.model S3 Object (also a list)\n\n',
'NChains: ', length(x$fit), '\n',
'Model Type: ', x$model))
'NChains: ', length(object$fit), '\n',
'Model Type: ', object$model))
return(invisible())
}

Expand All @@ -92,9 +93,9 @@ str.skipTrack.model <- function(x){
#' #Simulated data
#' simDat <- skipTrack.simulate(n = 100, skipProb = c(.7, .2, .1))
#'
#' #Run model fit
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 500)
#' summary(modFit, burnIn = 250)
#' #Run model fit (should typically run with much more than 50 reps)
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 50)
#' summary(modFit, burnIn = 25) #Recommended burnIn with real data is at least 750
#'
#'
summary.skipTrack.model <- function(object, ...){
Expand Down
4 changes: 2 additions & 2 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ if(getRversion() >= "2.15.1") utils::globalVariables(c("ys", "cijs", 'taus',
#' #Simulated data
#' simDat <- skipTrack.simulate(n = 100, skipProb = c(.7, .2, .1))
#'
#' #Run model fit
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 500)
#' #Run model fit (should typically run with much more than 50 reps)
#' modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 50)
#'
#' #Visualize results
#' skipTrack.visualize(modFit)
Expand Down
4 changes: 2 additions & 2 deletions man/plot.skipTrack.model.Rd

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

4 changes: 2 additions & 2 deletions man/print.skipTrack.model.Rd

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

2 changes: 1 addition & 1 deletion man/skipTrack-package.Rd

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

4 changes: 2 additions & 2 deletions man/skipTrack.diagnostics.Rd

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

4 changes: 2 additions & 2 deletions man/skipTrack.fit.Rd

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

9 changes: 6 additions & 3 deletions man/skipTrack.results.Rd

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

4 changes: 2 additions & 2 deletions man/skipTrack.visualize.Rd

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

10 changes: 6 additions & 4 deletions man/str.skipTrack.model.Rd

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

6 changes: 3 additions & 3 deletions man/summary.skipTrack.model.Rd

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

0 comments on commit 3e56a92

Please sign in to comment.