R/CreateArgFunctions.R

Defines functions createFitSccsModelArgs createCreateScriIntervalDataArgs createCreateSccsIntervalDataArgs createCreateStudyPopulationArgs createGetDbSccsDataArgs

Documented in createCreateSccsIntervalDataArgs createCreateScriIntervalDataArgs createCreateStudyPopulationArgs createFitSccsModelArgs createGetDbSccsDataArgs

# This file has been autogenerated. Do not change by hand.

#' Create a parameter object for the function getDbSccsData
#'
#' @details
#' Create an object defining the parameter values.
#'
#' @param useCustomCovariates  DEPRECATED. Set customCovariateIds to non-null value to use custom cohorts.
#' @param useNestingCohort  DEPRECATED. Set nestingCohortId to non-null value to use a nesting cohort.
#' @param nestingCohortId  A cohort definition ID identifying the records in the nestingCohortTable to use as nesting cohort.
#' @param deleteCovariatesSmallCount  The minimum count for a covariate to appear in the data to be kept.
#' @param studyStartDate  DEPRECATED. Use studyStartDates instead.
#' @param studyEndDate  DEPRECATED. Use studyEndDates instead.
#' @param studyStartDates  A character object specifying the minimum dates where data is used. Date format is 'yyyymmdd'. Use "" to indicate all time prior. See section for more information.
#' @param studyEndDates  A character object specifying the maximum dates where data is used. Date format is 'yyyymmdd'. Use "" to indicate to the end of observation. See section for more information.
#' @param maxCasesPerOutcome  If there are more than this number of cases for a single outcome cases will be sampled to this size. maxCasesPerOutcome = 0 indicates no maximum size.
#' @param exposureIds  A list of identifiers to extract from the exposure table. If exposureTable = DRUG_ERA, exposureIds should be CONCEPT_ID. If exposureTable = "drug_era", exposureIds is used to select the drug_concept_id. If no exposure IDs are provided, all drugs or cohorts in the exposureTable are included as exposures.
#' @param customCovariateIds  A list of cohort definition IDs identifying the records in the customCovariateTable to use for building custom covariates.
#'
#' @export
createGetDbSccsDataArgs <- function(useCustomCovariates = FALSE,
                                    useNestingCohort = FALSE,
                                    nestingCohortId = NULL,
                                    deleteCovariatesSmallCount = 0,
                                    studyStartDate = "",
                                    studyEndDate = "",
                                    studyStartDates = c(),
                                    studyEndDates = c(),
                                    maxCasesPerOutcome = 0,
                                    exposureIds = "exposureId",
                                    customCovariateIds = "") {
  analysis <- list()
  for (name in names(formals(createGetDbSccsDataArgs))) {
    analysis[[name]] <- get(name)
  }
  class(analysis) <- "args"
  return(analysis)
}

#' Create a parameter object for the function createStudyPopulation
#'
#' @details
#' Create an object defining the parameter values.
#'
#' @param firstOutcomeOnly  Whether only the first occurrence of an outcome should be considered.
#' @param naivePeriod  The number of days at the start of a patient's observation period that should not be included in the risk calculations. Note that the naive period can be used to determine current covariate status right after the naive period, and whether an outcome is the first one.
#' @param minAge  Minimum age at which patient time will be included in the analysis. Note that information prior to the min age is still used to determine exposure status after the minimum age (e.g. when a prescription was started just prior to reaching the minimum age). Also, outcomes occurring before the minimum age is reached will be considered as prior outcomes when using first outcomes only. Age should be specified in years, but non-integer values are allowed. If not specified, no age restriction will be applied.
#' @param maxAge  Maximum age at which patient time will be included in the analysis. Age should be specified in years, but non-integer values are allowed. If not specified, no age restriction will be applied.
#' @param genderConceptIds  Set of gender concept IDs to restrict the population to. If not specified, no restriction on gender will be applied.
#' @param restrictTimeToEraId  If provided, study time (for all patients) will be restricted to the calender time when that era was observed in the data. For example, if the era ID refers to a drug, study time will be restricted to when the drug was on the market.
#'
#' @export
createCreateStudyPopulationArgs <- function(firstOutcomeOnly = FALSE,
                                            naivePeriod = 0,
                                            minAge = NULL,
                                            maxAge = NULL,
                                            genderConceptIds = NULL,
                                            restrictTimeToEraId = NULL) {
  analysis <- list()
  for (name in names(formals(createCreateStudyPopulationArgs))) {
    analysis[[name]] <- get(name)
  }
  class(analysis) <- "args"
  return(analysis)
}

#' Create a parameter object for the function createSccsIntervalData
#'
#' @details
#' Create an object defining the parameter values.
#'
#' @param eraCovariateSettings  Either an object of type EraCovariateSettings as created using the createEraCovariateSettings() function, or a list of such objects.
#' @param ageCovariateSettings  An object of type ageCovariateSettings as created using the createAgeCovariateSettings() function.
#' @param seasonalityCovariateSettings  An object of type seasonalityCovariateSettings as created using the createSeasonalityCovariateSettings() function.
#' @param calendarTimeCovariateSettings  An object of type calendarTimeCovariateSettings as created using the createCalendarTimeCovariateSettings() function.
#' @param minCasesForAgeSeason  DEPRECATED: Use minCasesForTimeCovariates instead.
#' @param minCasesForTimeCovariates  Minimum number of cases to use to fit age, season and calendar time splines. If needed (and available), cases that are not exposed will be included.
#' @param eventDependentObservation  Should the extension proposed by Farrington et al. be used to adjust for event-dependent observation time?
#'
#' @export
createCreateSccsIntervalDataArgs <- function(eraCovariateSettings,
                                             ageCovariateSettings = NULL,
                                             seasonalityCovariateSettings = NULL,
                                             calendarTimeCovariateSettings = NULL,
                                             minCasesForAgeSeason = NULL,
                                             minCasesForTimeCovariates = 10000,
                                             eventDependentObservation = FALSE) {
  analysis <- list()
  for (name in names(formals(createCreateSccsIntervalDataArgs))) {
    analysis[[name]] <- get(name)
  }
  class(analysis) <- "args"
  return(analysis)
}

#' Create a parameter object for the function createScriIntervalData
#'
#' @details
#' Create an object defining the parameter values.
#'
#' @param eraCovariateSettings  Either an object of type EraCovariateSettings as created using the createEraCovariateSettings() function, or a list of such objects.
#' @param controlIntervalSettings  An object of type ControlIntervalSettings as created using the createControlIntervalSettings() function.
#'
#' @export
createCreateScriIntervalDataArgs <- function(eraCovariateSettings,
                                             controlIntervalSettings) {
  analysis <- list()
  for (name in names(formals(createCreateScriIntervalDataArgs))) {
    analysis[[name]] <- get(name)
  }
  class(analysis) <- "args"
  return(analysis)
}

#' Create a parameter object for the function fitSccsModel
#'
#' @details
#' Create an object defining the parameter values.
#'
#' @param prior  The prior used to fit the model. See Cyclops::createPrior for details.
#' @param control  The control object used to control the cross-validation used to determine the hyperparameters of the prior (if applicable). See Cyclops::createControl for details.
#' @param profileGrid  A one-dimensional grid of points on the log(relative risk) scale where the likelihood for coefficient of variables is sampled. See details.
#' @param profileBounds  The bounds (on the log relative risk scale) for the adaptive sampling of the likelihood function.
#'
#' @export
createFitSccsModelArgs <- function(prior = createPrior("laplace", useCrossValidation = TRUE),
                                   control = createControl(cvType = "auto", selectorType = "byPid", startingVariance = 0.1, seed = 1, resetCoefficients = TRUE, noiseLevel = "quiet"),
                                   profileGrid = NULL,
                                   profileBounds = c(log(0.1), log(10))) {
  analysis <- list()
  for (name in names(formals(createFitSccsModelArgs))) {
    analysis[[name]] <- get(name)
  }
  class(analysis) <- "args"
  return(analysis)
}
OHDSI/SelfControlledCaseSeries documentation built on Jan. 31, 2024, 7:30 p.m.