diff --git a/DESCRIPTION b/DESCRIPTION index 9edc33a..5cf6bb1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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) . +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) . License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) diff --git a/R/diagnostics.R b/R/diagnostics.R index 2072eb3..ce12a0a 100644 --- a/R/diagnostics.R +++ b/R/diagnostics.R @@ -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') diff --git a/R/fit.R b/R/fit.R index 405e6dd..c4a0f44 100644 --- a/R/fit.R +++ b/R/fit.R @@ -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, diff --git a/R/results.R b/R/results.R index 8191e7a..e34e553 100644 --- a/R/results.R +++ b/R/results.R @@ -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){ diff --git a/R/utils.R b/R/utils.R index c65d284..ec9a22f 100644 --- a/R/utils.R +++ b/R/utils.R @@ -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, ...){ @@ -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) #' #' @@ -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 @@ -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()) } @@ -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, ...){ diff --git a/R/visualization.R b/R/visualization.R index d1263d0..3e75f57 100644 --- a/R/visualization.R +++ b/R/visualization.R @@ -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) diff --git a/man/plot.skipTrack.model.Rd b/man/plot.skipTrack.model.Rd index 4cf6e4f..156c742 100644 --- a/man/plot.skipTrack.model.Rd +++ b/man/plot.skipTrack.model.Rd @@ -21,8 +21,8 @@ Plot skipTrack.model objects #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) } diff --git a/man/print.skipTrack.model.Rd b/man/print.skipTrack.model.Rd index 42011a4..ab25c75 100644 --- a/man/print.skipTrack.model.Rd +++ b/man/print.skipTrack.model.Rd @@ -21,8 +21,8 @@ Print skipTrack.model to console #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) diff --git a/man/skipTrack-package.Rd b/man/skipTrack-package.Rd index 9b9ff8b..abb002a 100644 --- a/man/skipTrack-package.Rd +++ b/man/skipTrack-package.Rd @@ -6,7 +6,7 @@ \alias{skipTrack-package} \title{skipTrack: A Bayesian Hierarchical Model that Controls for Non-Adherence in Mobile Menstrual Cycle Tracking} \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}. +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}. } \seealso{ Useful links: diff --git a/man/skipTrack.diagnostics.Rd b/man/skipTrack.diagnostics.Rd index c7483ff..92e15f5 100644 --- a/man/skipTrack.diagnostics.Rd +++ b/man/skipTrack.diagnostics.Rd @@ -47,8 +47,8 @@ Details on the genDiagnostic function can be found in the genMCMCDiag package. #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') diff --git a/man/skipTrack.fit.Rd b/man/skipTrack.fit.Rd index 0d1279a..102cf4d 100644 --- a/man/skipTrack.fit.Rd +++ b/man/skipTrack.fit.Rd @@ -52,8 +52,8 @@ This function fits the model using multiple instances of skipTrack.MCMC, either #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 } diff --git a/man/skipTrack.results.Rd b/man/skipTrack.results.Rd index 2c4c151..a44f51d 100644 --- a/man/skipTrack.results.Rd +++ b/man/skipTrack.results.Rd @@ -29,15 +29,18 @@ Note that true values and converage are included in the output if trueVals is su #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 = 25) +#Recommended burnIn with real data is at least 750 } diff --git a/man/skipTrack.visualize.Rd b/man/skipTrack.visualize.Rd index eaaa670..eb4351f 100644 --- a/man/skipTrack.visualize.Rd +++ b/man/skipTrack.visualize.Rd @@ -24,8 +24,8 @@ This function takes results from skipTrack.fit and produces several helpful visu #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) diff --git a/man/str.skipTrack.model.Rd b/man/str.skipTrack.model.Rd index edcae63..dd6e0ff 100644 --- a/man/str.skipTrack.model.Rd +++ b/man/str.skipTrack.model.Rd @@ -4,10 +4,12 @@ \alias{str.skipTrack.model} \title{Report skipTrack.model structure to console} \usage{ -\method{str}{skipTrack.model}(x) +\method{str}{skipTrack.model}(object, ...) } \arguments{ -\item{x}{skipTrack.model object from the function skipTrack.fit} +\item{object}{skipTrack.model object from the function skipTrack.fit} + +\item{...}{To match other str calls} } \value{ Invisible NULL. Prints structure of skipTrack.model object @@ -19,8 +21,8 @@ Report skipTrack.model structure to console #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) diff --git a/man/summary.skipTrack.model.Rd b/man/summary.skipTrack.model.Rd index f0ee29d..f3bbea7 100644 --- a/man/summary.skipTrack.model.Rd +++ b/man/summary.skipTrack.model.Rd @@ -21,9 +21,9 @@ Report skipTrack.model results to console #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 }