Skip to content

Commit

Permalink
much more documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrkaufman committed Aug 15, 2023
1 parent ab9179e commit 7f637b9
Show file tree
Hide file tree
Showing 27 changed files with 213 additions and 215 deletions.
46 changes: 23 additions & 23 deletions R/pj_estimate.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@
#' @import estimatr
#' @importFrom MASS mvrnorm
#' @keywords internal
#' @param .data A `projoint_data` object
#' @param .structure Either "profile_level" (default) or "choice_level"
#' @param .estimand Either "mm" for marginal mean or "amce" for average marginal component effect
#' @param .att_choose A character column name identifying the attribute of interest (i.e., for the attribute-level or attribute-levels *chosen*).
#' @param .lev_choose A character vector identifying the level or levels of interest (i.e., for the attribute-level or attribute-levels *chosen*). Its length should be 1 for profile-level analysis and 1+ for choice-level analysis
#' @param .att_notchoose A character column name identifying the attribute of interest (i.e., for the attribute-level or attribute-levels *not chosen*). This argument should be specified only if the `.structure` argument is "choice-level".
#' @param .lev_notchoose A character vector identifying the level or levels of interest (i.e., for the attribute-level or attribute-levels *not chosen*). Its length should be 1 for profile-level analysis and 1+ for choice-level analysis. This argument should be specified only if the `.structure` argument is "choice-level".
#' @param .att_choose_b [baseline for AMCE] A character column name identifying the attribute of interest (i.e., for the attribute-level or attribute-levels *chosen*).
#' @param .lev_choose_b [baseline for AMCE] A character vector identifying the level or levels of interest (i.e., for the attribute-level or attribute-levels *chosen*). Its length should be 1 for profile-level analysis and 1+ for choice-level analysis
#' @param .att_notchoose_b [baseline for AMCE] A character column name identifying the attribute of interest (i.e., for the attribute-level or attribute-levels *not chosen*). This argument should be specified only if the `.structure` argument is "choice-level".
#' @param .lev_notchoose_b [baseline for AMCE] A character vector identifying the level or levels of interest (i.e., for the attribute-level or attribute-levels *not chosen*). Its length should be 1 for profile-level analysis and 1+ for choice-level analysis. This argument should be specified only if the `.structure` argument is "choice-level".
#' @param .se_method c("analytic", "simulation", "bootstrap") description
#' @param .irr NULL (default) if IRR is to be calculated using the repeated task. Otherwise, a numerical value
#' @param .remove_ties Logical: should ties be removed before estimation? Defaults to TRUE.
#' @param .ignore_position TRUE (default) if you ignore the location of profile (left or right. Relevant only if analyzed at the choice level
#' @param .n_sims The number of simulations. Relevant only if .se_method == "simulation"
#' @param .n_boot The number of bootstrapped samples. Relevant only if .se_method == "bootstrap"
#' @param .weights_1 the weight to estimate IRR (see `lm_robust()`): NULL (default)
#' @param .clusters_1 the clusters to estimate IRR (see `lm_robust()`): NULL (default)
#' @param .se_type_1 the standard error type to estimate IRR (see `lm_robust()`): "classical" (default)
#' @param .weights_2 the weight to estimate MM or AMCE (see `lm_robust()`): NULL (default)
#' @param .clusters_2 the clusters to estimate MM or AMCE (see `lm_robust()`): NULL (default)
#' @param .se_type_2 the standard error type to estimate MM or AMCE (see `lm_robust()`): "classical" (default)
#' @param .data A \code{\link{projoint_data}} object
#' @param .structure Either \code{"profile_level"} (default) or \code{"choice_level"}
#' @param .estimand Either \code{"mm"} for marginal mean or \code{"amce"} for average marginal component effect
#' @param .att_choose A character column name identifying the attribute of interest (i.e., for the attribute-level or attribute-levels \strong{chosen}).
#' @param .lev_choose A character vector identifying the level or levels of interest (i.e., for the attribute-level or attribute-levels \strong{chosen}). Its length should be 1 for profile-level analysis and 1+ for choice-level analysis
#' @param .att_notchoose A character column name identifying the attribute of interest (i.e., for the attribute-level or attribute-levels \strong{not chosen}). This argument should be specified only if the \code{.structure} argument is \code{"choice-level"}.
#' @param .lev_notchoose A character vector identifying the level or levels of interest (i.e., for the attribute-level or attribute-levels \strong{not chosen}). Its length should be 1 for profile-level analysis and 1+ for choice-level analysis. This argument should be specified only if the \code{.structure} argument is \code{"choice-level"}.
#' @param .att_choose_b [baseline for AMCE] A character column name identifying the attribute of interest (i.e., for the attribute-level or attribute-levels \strong{chosen}).
#' @param .lev_choose_b [baseline for AMCE] A character vector identifying the level or levels of interest (i.e., for the attribute-level or attribute-levels \strong{chosen}). Its length should be 1 for profile-level analysis and 1+ for choice-level analysis
#' @param .att_notchoose_b [baseline for AMCE] A character column name identifying the attribute of interest (i.e., for the attribute-level or attribute-levels \strong{not chosen*}). This argument should be specified only if the \code{.structure} argument is \code{"choice-level"}.
#' @param .lev_notchoose_b [baseline for AMCE] A character vector identifying the level or levels of interest (i.e., for the attribute-level or attribute-levels \strong{not chosen}). Its length should be 1 for profile-level analysis and 1+ for choice-level analysis. This argument should be specified only if the \code{.structure} argument is \code{"choice-level"}.
#' @param .se_method By default, \code{c("analytic", "simulation", "bootstrap")} description
#' @param .irr \code{NULL} (default) if IRR is to be calculated using the repeated task. Otherwise, a numerical value
#' @param .remove_ties Logical: should ties be removed before estimation? Defaults to \code{TRUE}.
#' @param .ignore_position \code{TRUE} (default) if you ignore the location of profile (left or right). Relevant only if analyzed at the choice level
#' @param .n_sims The number of simulations. Relevant only if \code{.se_method == "simulation"}
#' @param .n_boot The number of bootstrapped samples. Relevant only if \code{.se_method == "bootstrap"}
#' @param .weights_1 the weight to estimate IRR (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .clusters_1 the clusters to estimate IRR (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .se_type_1 the standard error type to estimate IRR (see \code{\link[estimatr]{lm_robust}}): \code{"classical"} (default)
#' @param .weights_2 the weight to estimate MM or AMCE (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .clusters_2 the clusters to estimate MM or AMCE (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .se_type_2 the standard error type to estimate MM or AMCE (see \code{\link[estimatr]{lm_robust}}): \code{"classical"} (default)
#' @return A data frame of estimates

# .data <- df
Expand Down
6 changes: 3 additions & 3 deletions R/plot.projoint_results.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#' Plot all MMs or AMCEs
#'
#' This method produces MM or AMCE plots given a \code\link{projoint_results} object, the output from the \code\link{projoint} function.
#' This method produces MM or AMCE plots given a \code{\link{projoint_results}} object, the output from the \code{\link{projoint}} function.
#'
#' @import ggplot2
#' @import ggthemes
#' @import dplyr
#' @import stringr
#' @param x A \code\link{projoint_results} object
#' @param x A \code{\link{projoint_results}} object
#' @param .estimand Either \code{"mm"} for marginal mean (default) or \code{"amce"} for average marginal component effect
#' @param .estimates The estimates to be plotted, either \code{"corrected"} (default), \code{"uncorrected"}, or \code{"both"}
#' @param .by_var \code{TRUE} to plot the difference in estimates between the two subgroups, \code{FALSE} (default) otherwise
#' @param .base_size base font size, given in pts.
#' @param .base_family base font family
#' @param ... Additional optional arguments
#' @return A ggplot object
#' @return A \code{ggplot} object
#' @export
#' @examples
#'
Expand Down
8 changes: 4 additions & 4 deletions R/predict_tau.R
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ predict_tau <- function(



#' @param x An object of class `projoint_tau` derived from `predict_tau`
#' @param x An object of class \code{\link{projoint_tau}} derived from \code{\link{predict_tau}}
#' @param ... Optional arguments; currently none accepted
#' @export
#' @rdname predict_tau
Expand All @@ -291,17 +291,17 @@ print.projoint_tau <- function(x, ...) {
# No results
}

#' @param object An object of class `projoint_tau` derived from `predict_tau`
#' @param object An object of class \code{\link{projoint_tau}} derived from \code{\link{predict_tau}}
#' @param ... Optional arguments; currently none accepted
#' @export
#' @return A tibble showing IRR as profile similarity changes. The value of `predicted` when `x=0` is the estimated IRR.
#' @return A tibble showing IRR as profile similarity changes. The value of \code{predicted} when \code{x=0} is the estimated IRR.
#' @rdname predict_tau

summary.projoint_tau <- function(object, ...) {
object@irr
}

#' @param x An object of class `projoint_tau` derived from `predict_tau`
#' @param x An object of class \code{\link{projoint_tau}} derived from \code{\link{predict_tau}}
#' @param ... Optional arguments; currently none accepted
#' @export
#' @rdname predict_tau
Expand Down
38 changes: 19 additions & 19 deletions R/projoint.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
#' @importFrom MASS mvrnorm
#' @importFrom methods is
#' @importFrom methods new
#' @param .data A `projoint_data` object
#' @param .qoi A `projoint_qoi` object. If NULL, defaults to producing all MMs and all AMCEs.
#' @param .data A \code{\link{projoint_data}} object
#' @param .qoi A \code{\link{projoint_qoi}} object. If \code{NULL}, defaults to producing all MMs and all AMCEs.
#' @param .by_var A dichotomous variable (character) used for subgroup analysis
#' @param .structure Either "profile_level" (default) or "choice_level"
#' @param .estimand Either "mm" for marginal mean or "amce" for average marginal component effect
#' @param .se_method c("analytic", "simulation", "bootstrap") description
#' @param .irr NULL (default) if IRR is to be calculated using the repeated task. Otherwise, a numerical value
#' @param .remove_ties Logical: should ties be removed before estimation? Defaults to TRUE.
#' @param .ignore_position TRUE (default) if you ignore the location of profile (left or right. Relevant only if analyzed at the choice level
#' @param .n_sims The number of simulations. Relevant only if .se_method == "simulation"
#' @param .n_boot The number of bootstrapped samples. Relevant only if .se_method == "bootstrap"
#' @param .weights_1 the weight to estimate IRR (see `lm_robust()`): NULL (default)
#' @param .clusters_1 the clusters to estimate IRR (see `lm_robust()`): NULL (default)
#' @param .se_type_1 the standard error type to estimate IRR (see `lm_robust()`): "classical" (default)
#' @param .weights_2 the weight to estimate MM or AMCE (see `lm_robust()`): NULL (default)
#' @param .clusters_2 the clusters to estimate MM or AMCE (see `lm_robust()`): NULL (default)
#' @param .se_type_2 the standard error type to estimate MM or AMCE (see `lm_robust()`): "classical" (default)
#' @return A `projoint_results` object
#' @param .structure Either \code{"profile_level"} (default) or \code{"choice_level"}
#' @param .estimand Either \code{"mm"} for marginal mean or \code{"amce"} for average marginal component effect
#' @param .se_method By default, \code{c("analytic", "simulation", "bootstrap")} description
#' @param .irr \code{NULL} (default) if IRR is to be calculated using the repeated task. Otherwise, a numerical value
#' @param .remove_ties Logical: should ties be removed before estimation? Defaults to \code{TRUE}.
#' @param .ignore_position TRUE (default) if you ignore the location of profile (left or right). Relevant only if analyzed at the choice level
#' @param .n_sims The number of simulations. Relevant only if \code{.se_method == "simulation"}
#' @param .n_boot The number of bootstrapped samples. Relevant only if \code{.se_method == "bootstrap"}
#' @param .weights_1 the weight to estimate IRR (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .clusters_1 the clusters to estimate IRR (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .se_type_1 the standard error type to estimate IRR (see \code{\link[estimatr]{lm_robust}}): \code{"classical"} (default)
#' @param .weights_2 the weight to estimate MM or AMCE (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .clusters_2 the clusters to estimate MM or AMCE (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .se_type_2 the standard error type to estimate MM or AMCE (see \code{\link[estimatr]{lm_robust}}): \code{"classical"} (default)
#' @return A \code{\link{projoint_results}} object
#' @export
#' @examples
#'
Expand Down Expand Up @@ -113,7 +113,7 @@ projoint <- function(
}


#' @param x A `projoint_results` object
#' @param x A \code{\link{projoint_results}} object
#' @param ... Optional arguments; currently none accepted
#' @export
#' @rdname projoint
Expand All @@ -133,7 +133,7 @@ print.projoint_results <- function(x, ...) {
}


#' @param object A projoint_results object
#' @param object A \code{\link{projoint_results}} object
#' @param ... Optional arguments; currently none accepted
#' @export
#' @rdname projoint
Expand Down
2 changes: 1 addition & 1 deletion R/projoint_data.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Class generator for `projoint_data`
#' Class generator for \code{\link{projoint_data}}
#' @importFrom methods is
#' @importFrom methods new
#' @keywords internal
Expand Down
34 changes: 17 additions & 17 deletions R/projoint_diff.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
#' @importFrom methods is
#' @importFrom methods new
#' @keywords internal
#' @param .data A `projoint_data` object
#' @param .qoi A `projoint_qoi` object. If NULL, defaults to producing all MMs and all AMCEs.
#' @param .data A \code{\link{projoint_data}} object
#' @param .qoi A \code{\link{projoint_qoi}} object. If \code{NULL}, defaults to producing all MMs and all AMCEs.
#' @param .by_var A dichotomous variable (character) used for subgroup analysis
#' @param .structure Either "profile_level" (default) or "choice_level"
#' @param .estimand Either "mm" for marginal mean or "amce" for average marginal component effect
#' @param .se_method c("analytic", "simulation", "bootstrap") description
#' @param .irr NULL (default) if IRR is to be calculated using the repeated task. Otherwise, a numerical value
#' @param .remove_ties Logical: should ties be removed before estimation? Defaults to TRUE.
#' @param .ignore_position TRUE (default) if you ignore the location of profile (left or right. Relevant only if analyzed at the choice level
#' @param .n_sims The number of simulations. Relevant only if .se_method == "simulation"
#' @param .n_boot The number of bootstrapped samples. Relevant only if .se_method == "bootstrap"
#' @param .weights_1 the weight to estimate IRR (see `lm_robust()`): NULL (default)
#' @param .clusters_1 the clusters to estimate IRR (see `lm_robust()`): NULL (default)
#' @param .se_type_1 the standard error type to estimate IRR (see `lm_robust()`): "classical" (default)
#' @param .weights_2 the weight to estimate MM or AMCE (see `lm_robust()`): NULL (default)
#' @param .clusters_2 the clusters to estimate MM or AMCE (see `lm_robust()`): NULL (default)
#' @param .se_type_2 the standard error type to estimate MM or AMCE (see `lm_robust()`): "classical" (default)
#' @return A `projoint_results` object
#' @param .structure Either \code{"profile_level"} (default) or \code{"choice_level"}
#' @param .estimand Either \code{"mm"} for marginal mean or \code{"amce"} for average marginal component effect
#' @param .se_method By default, \code{c("analytic", "simulation", "bootstrap")} description
#' @param .irr \code{NULL} (default) if IRR is to be calculated using the repeated task. Otherwise, a numerical value
#' @param .remove_ties Logical: should ties be removed before estimation? Defaults to \code{TRUE}.
#' @param .ignore_position TRUE (default) if you ignore the location of profile (left or right). Relevant only if analyzed at the choice level
#' @param .n_sims The number of simulations. Relevant only if \code{.se_method == "simulation"}
#' @param .n_boot The number of bootstrapped samples. Relevant only if \code{.se_method == "bootstrap"}
#' @param .weights_1 the weight to estimate IRR (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .clusters_1 the clusters to estimate IRR (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .se_type_1 the standard error type to estimate IRR (see \code{\link[estimatr]{lm_robust}}): \code{"classical"} (default)
#' @param .weights_2 the weight to estimate MM or AMCE (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .clusters_2 the clusters to estimate MM or AMCE (see \code{\link[estimatr]{lm_robust}}): \code{NULL} (default)
#' @param .se_type_2 the standard error type to estimate MM or AMCE (see \code{\link[estimatr]{lm_robust}}): \code{"classical"} (default)
#' @return A \code{\link{projoint_results}} object

projoint_diff <- function(
.data,
Expand Down
Loading

0 comments on commit 7f637b9

Please sign in to comment.