Skip to content

Commit 6eed6b7

Browse files
authored
Merge pull request #236 from StochasticTree/r-doc-abbreviation
Add abbreviated summary of several R functions for the doc site
2 parents b071c86 + e954fdc commit 6eed6b7

13 files changed

+58
-51
lines changed

R/posterior_transformation.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#' Compute a contrast between two outcome prediction specifications for a BCF model
2+
#'
13
#' Compute a contrast using a BCF model by making two sets of outcome predictions and taking their difference.
24
#' For simple BCF models with binary treatment, this will yield the same prediction as requesting `terms = "cate"`
35
#' in the `predict.bcfmodel` function. For more general models, such as models with continuous / multivariate treatments or
@@ -245,6 +247,8 @@ compute_contrast_bcf_model <- function(
245247
}
246248
}
247249

250+
#' Compute a contrast between two outcome prediction specifications for a BART model
251+
#'
248252
#' Compute a contrast using a BART model by making two sets of outcome predictions and taking their difference.
249253
#' This function provides the flexibility to compute any contrast of interest by specifying covariates, leaf basis, and random effects
250254
#' bases / IDs for both sides of a two term contrast. For simplicity, we refer to the subtrahend of the contrast as the "control" or
@@ -830,7 +834,8 @@ posterior_predictive_heuristic_multiplier <- function(
830834

831835
#' Compute posterior credible intervals for BCF model terms
832836
#'
833-
#' This function computes posterior credible intervals for specified terms from a fitted BCF model. It supports intervals for prognostic forests, CATE forests, variance forests, random effects, and overall mean outcome predictions.
837+
#' Compute posterior credible intervals for specified terms from a fitted BCF model. Supports intervals for prognostic forests, CATE forests, variance forests, random effects, and overall mean outcome predictions.
838+
#'
834839
#' @param model_object A fitted BCF model object of class `bcfmodel`.
835840
#' @param terms A character string specifying the model term(s) for which to compute intervals. Options for BCF models are `"prognostic_function"`, `"mu"`, `"cate"`, `"tau"`, `"variance_forest"`, `"rfx"`, or `"y_hat"`. Note that `"mu"` is only different from `"prognostic_function"` if random effects are included with a model spec of `"intercept_only"` or `"intercept_plus_treatment"` and `"tau"` is only different from `"cate"` if random effects are included with a model spec of `"intercept_plus_treatment"`.
836841
#' @param level A numeric value between 0 and 1 specifying the credible interval level (default is 0.95 for a 95% credible interval).
@@ -1055,7 +1060,10 @@ compute_bcf_posterior_interval <- function(
10551060
}
10561061
}
10571062

1058-
#' Compute posterior credible intervals for specified terms from a fitted BART model. It supports intervals for mean functions, variance functions, random effects, and overall predictions.
1063+
#' Compute posterior credible intervals for specified terms from a fitted BART model.
1064+
#'
1065+
#' Compute posterior credible intervals for specified terms from a fitted BART model. Supports intervals for mean functions, variance functions, random effects, and overall outcome predictions.
1066+
#'
10591067
#' @param model_object A fitted BART or BCF model object of class `bartmodel`.
10601068
#' @param terms A character string specifying the model term(s) for which to compute intervals. Options for BART models are `"mean_forest"`, `"variance_forest"`, `"rfx"`, or `"y_hat"`.
10611069
#' @param level A numeric value between 0 and 1 specifying the credible interval level (default is 0.95 for a 95% credible interval).

R/random_effects.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
#' Class that wraps the "persistent" aspects of a C++ random effects model
2-
#' (draws of the parameters and a map from the original label indices to the
1+
#' Class that wraps the "persistent" aspects of a C++ random effects model.
2+
#'
3+
#' Class that wraps the "persistent" aspects of a C++ random effects model, including
4+
#' draws of the parameters and a map from the original label indices to the
35
#' 0-indexed label numbers used to place group samples in memory (i.e. the
46
#' first label is stored in column 0 of the sample matrix, the second label
5-
#' is store in column 1 of the sample matrix, etc...))
7+
#' is store in column 1 of the sample matrix, etc...)
68
#'
79
#' @description
810
#' Coordinates various C++ random effects classes and persists those

R/utils.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ preprocessParams <- function(default_params, user_params = NULL) {
2020
return(default_params)
2121
}
2222

23-
#' Preprocess covariates. DataFrames will be preprocessed based on their column
23+
#' Preprocess covariates for use in a `ForestDataset` at train time.
24+
#'
25+
#' Preprocess covariates for use in a `ForestDataset` at train time.
26+
#' DataFrames will be preprocessed based on their column
2427
#' types. Matrices will be passed through assuming all columns are numeric.
2528
#'
2629
#' @param input_data Covariates, provided as either a dataframe or a matrix
@@ -50,7 +53,10 @@ preprocessTrainData <- function(input_data) {
5053
return(output)
5154
}
5255

53-
#' Preprocess covariates. DataFrames will be preprocessed based on their column
56+
#' Preprocess covariates for use in a `ForestDataset` at prediction time.
57+
#'
58+
#' Preprocess covariates for use in a `ForestDataset` at prediction time.
59+
#' DataFrames will be preprocessed based on their column
5460
#' types. Matrices will be passed through assuming all columns are numeric.
5561
#'
5662
#' @param input_data Covariates, provided as either a dataframe or a matrix
@@ -1008,6 +1014,8 @@ expand_dims_1d <- function(input, output_size) {
10081014
return(output)
10091015
}
10101016

1017+
#' Ensures that input is propagated appropriately to a matrix of dimension `output_rows` x `output_cols`.
1018+
#'
10111019
#' Ensures that input is propagated appropriately to a matrix of dimension `output_rows` x `output_cols`.
10121020
#' Handles the following cases:
10131021
#' 1. `input` is a scalar: output is simply a (`output_rows`, `output_cols`) matrix with `input` repeated for each element

man/RandomEffectSamples.Rd

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bart.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bcf.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/compute_bart_posterior_interval.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/compute_bcf_posterior_interval.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/compute_contrast_bart_model.Rd

Lines changed: 10 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)