From 110b2191221ab97fbbc43a0685a5c9bf796e2336 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 19 Nov 2024 15:05:30 +0100 Subject: [PATCH] docs --- R/methods_FactoMineR.R | 2 - R/methods_bife.R | 3 +- R/methods_brglm2.R | 1 - R/methods_cplm.R | 3 + R/methods_lavaan.R | 3 +- R/methods_mice.R | 1 - R/methods_ordinal.R | 2 - man/ci.default.Rd | 3 + man/model_parameters.brmsfit.Rd | 3 + man/model_parameters.glimML.Rd | 3 + man/model_parameters.glmmTMB.Rd | 3 + man/model_parameters.mira.Rd | 14 +-- man/model_parameters.mlm.Rd | 144 ++++++++++-------------------- man/model_parameters.principal.Rd | 53 +---------- man/model_parameters.zcpglm.Rd | 3 + man/p_value.Rd | 3 + man/simulate_model.Rd | 3 + pkgdown/_pkgdown.yml | 5 +- 18 files changed, 82 insertions(+), 170 deletions(-) diff --git a/R/methods_FactoMineR.R b/R/methods_FactoMineR.R index 4de274ec6..bba84e5b9 100644 --- a/R/methods_FactoMineR.R +++ b/R/methods_FactoMineR.R @@ -1,5 +1,3 @@ -#' @inheritParams model_parameters.default -#' @rdname model_parameters.principal #' @export model_parameters.PCA <- function(model, sort = FALSE, diff --git a/R/methods_bife.R b/R/methods_bife.R index ac7b8c2fb..e9931b795 100644 --- a/R/methods_bife.R +++ b/R/methods_bife.R @@ -19,9 +19,8 @@ p_value.bife <- function(model, ...) { ) } -#' @rdname model_parameters.mlm -#' @export +#' @export model_parameters.bifeAPEs <- function(model, ...) { est <- model[["delta"]] se <- sqrt(diag(model[["vcov"]])) diff --git a/R/methods_brglm2.R b/R/methods_brglm2.R index acfd9a1c5..9270f7491 100644 --- a/R/methods_brglm2.R +++ b/R/methods_brglm2.R @@ -5,7 +5,6 @@ ############# .bracl -------------- -#' @rdname model_parameters.mlm #' @export model_parameters.bracl <- function(model, ci = 0.95, diff --git a/R/methods_cplm.R b/R/methods_cplm.R index 2419fde97..bfcaefa16 100644 --- a/R/methods_cplm.R +++ b/R/methods_cplm.R @@ -51,6 +51,9 @@ #' - **mvord**: `"thresholds"` and `"correlation"` #' - **clm2**: `"scale"` #' - **selection**: `"selection"`, `"outcome"`, and `"auxiliary"` +#' - **lavaan**: One or more of `"regression"`, `"correlation"`, `"loading"`, +#' `"variance"`, `"defined"`, or `"mean"`. Can also be `"all"` to include +#' all components. #' #' For models of class `brmsfit` (package **brms**), even more options are #' possible for the `component` argument, which are not all documented in detail diff --git a/R/methods_lavaan.R b/R/methods_lavaan.R index 860be03f0..c00bdf41f 100644 --- a/R/methods_lavaan.R +++ b/R/methods_lavaan.R @@ -4,12 +4,11 @@ # model parameters --------------------------- -#' @rdname model_parameters.principal #' @export model_parameters.lavaan <- function(model, ci = 0.95, standardize = FALSE, - component = c("regression", "correlation", "loading", "defined"), + component = "regression", keep = NULL, drop = NULL, verbose = TRUE, diff --git a/R/methods_mice.R b/R/methods_mice.R index ecadff56c..c9e67b741 100644 --- a/R/methods_mice.R +++ b/R/methods_mice.R @@ -67,7 +67,6 @@ format_parameters.mira <- format_parameters.rma # model_parameters --------------------------------- -#' @rdname model_parameters.mira #' @export model_parameters.mipo <- function(model, ci = 0.95, diff --git a/R/methods_ordinal.R b/R/methods_ordinal.R index 3c4a024bc..9bda0204b 100644 --- a/R/methods_ordinal.R +++ b/R/methods_ordinal.R @@ -1,7 +1,5 @@ # model parameters ------------------- - -#' @rdname model_parameters.mlm #' @export model_parameters.clm2 <- function(model, ci = 0.95, diff --git a/man/ci.default.Rd b/man/ci.default.Rd index 7446511c0..dabf34e9f 100644 --- a/man/ci.default.Rd +++ b/man/ci.default.Rd @@ -288,6 +288,9 @@ Some model classes also allow rather uncommon options. These are: \item \strong{mvord}: \code{"thresholds"} and \code{"correlation"} \item \strong{clm2}: \code{"scale"} \item \strong{selection}: \code{"selection"}, \code{"outcome"}, and \code{"auxiliary"} +\item \strong{lavaan}: One or more of \code{"regression"}, \code{"correlation"}, \code{"loading"}, +\code{"variance"}, \code{"defined"}, or \code{"mean"}. Can also be \code{"all"} to include +all components. } For models of class \code{brmsfit} (package \strong{brms}), even more options are diff --git a/man/model_parameters.brmsfit.Rd b/man/model_parameters.brmsfit.Rd index 841f65f49..be943e04d 100644 --- a/man/model_parameters.brmsfit.Rd +++ b/man/model_parameters.brmsfit.Rd @@ -412,6 +412,9 @@ Some model classes also allow rather uncommon options. These are: \item \strong{mvord}: \code{"thresholds"} and \code{"correlation"} \item \strong{clm2}: \code{"scale"} \item \strong{selection}: \code{"selection"}, \code{"outcome"}, and \code{"auxiliary"} +\item \strong{lavaan}: One or more of \code{"regression"}, \code{"correlation"}, \code{"loading"}, +\code{"variance"}, \code{"defined"}, or \code{"mean"}. Can also be \code{"all"} to include +all components. } For models of class \code{brmsfit} (package \strong{brms}), even more options are diff --git a/man/model_parameters.glimML.Rd b/man/model_parameters.glimML.Rd index 9703b2702..c5d9c5266 100644 --- a/man/model_parameters.glimML.Rd +++ b/man/model_parameters.glimML.Rd @@ -171,6 +171,9 @@ Some model classes also allow rather uncommon options. These are: \item \strong{mvord}: \code{"thresholds"} and \code{"correlation"} \item \strong{clm2}: \code{"scale"} \item \strong{selection}: \code{"selection"}, \code{"outcome"}, and \code{"auxiliary"} +\item \strong{lavaan}: One or more of \code{"regression"}, \code{"correlation"}, \code{"loading"}, +\code{"variance"}, \code{"defined"}, or \code{"mean"}. Can also be \code{"all"} to include +all components. } For models of class \code{brmsfit} (package \strong{brms}), even more options are diff --git a/man/model_parameters.glmmTMB.Rd b/man/model_parameters.glmmTMB.Rd index 527fb6eb2..ab7482d5d 100644 --- a/man/model_parameters.glmmTMB.Rd +++ b/man/model_parameters.glmmTMB.Rd @@ -300,6 +300,9 @@ Some model classes also allow rather uncommon options. These are: \item \strong{mvord}: \code{"thresholds"} and \code{"correlation"} \item \strong{clm2}: \code{"scale"} \item \strong{selection}: \code{"selection"}, \code{"outcome"}, and \code{"auxiliary"} +\item \strong{lavaan}: One or more of \code{"regression"}, \code{"correlation"}, \code{"loading"}, +\code{"variance"}, \code{"defined"}, or \code{"mean"}. Can also be \code{"all"} to include +all components. } For models of class \code{brmsfit} (package \strong{brms}), even more options are diff --git a/man/model_parameters.mira.Rd b/man/model_parameters.mira.Rd index 785151ae2..2fe10c2b3 100644 --- a/man/model_parameters.mira.Rd +++ b/man/model_parameters.mira.Rd @@ -1,21 +1,9 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/methods_mice.R -\name{model_parameters.mipo} -\alias{model_parameters.mipo} +\name{model_parameters.mira} \alias{model_parameters.mira} \title{Parameters from multiply imputed repeated analyses} \usage{ -\method{model_parameters}{mipo}( - model, - ci = 0.95, - exponentiate = FALSE, - p_adjust = NULL, - keep = NULL, - drop = NULL, - verbose = TRUE, - ... -) - \method{model_parameters}{mira}( model, ci = 0.95, diff --git a/man/model_parameters.mlm.Rd b/man/model_parameters.mlm.Rd index 7480c38c1..2f7f7ec28 100644 --- a/man/model_parameters.mlm.Rd +++ b/man/model_parameters.mlm.Rd @@ -1,31 +1,9 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/methods_bife.R, R/methods_brglm2.R, -% R/methods_mlm.R, R/methods_ordinal.R -\name{model_parameters.bifeAPEs} -\alias{model_parameters.bifeAPEs} -\alias{model_parameters.bracl} +% Please edit documentation in R/methods_mlm.R +\name{model_parameters.mlm} \alias{model_parameters.mlm} -\alias{model_parameters.clm2} \title{Parameters from multinomial or cumulative link models} \usage{ -\method{model_parameters}{bifeAPEs}(model, ...) - -\method{model_parameters}{bracl}( - model, - ci = 0.95, - bootstrap = FALSE, - iterations = 1000, - standardize = NULL, - exponentiate = FALSE, - p_adjust = NULL, - summary = getOption("parameters_summary", FALSE), - include_info = getOption("parameters_info", FALSE), - keep = NULL, - drop = NULL, - verbose = TRUE, - ... -) - \method{model_parameters}{mlm}( model, ci = 0.95, @@ -41,48 +19,40 @@ verbose = TRUE, ... ) - -\method{model_parameters}{clm2}( - model, - ci = 0.95, - bootstrap = FALSE, - iterations = 1000, - component = "all", - standardize = NULL, - exponentiate = FALSE, - p_adjust = NULL, - summary = getOption("parameters_summary", FALSE), - include_info = getOption("parameters_info", FALSE), - keep = NULL, - drop = NULL, - verbose = TRUE, - ... -) } \arguments{ \item{model}{A model with multinomial or categorical response value.} -\item{...}{Arguments passed to or from other methods. For instance, when -\code{bootstrap = TRUE}, arguments like \code{type} or \code{parallel} are passed down to -\code{bootstrap_model()}. +\item{ci}{Confidence Interval (CI) level. Default to \code{0.95} (\verb{95\%}).} -Further non-documented arguments are: +\item{vcov}{Variance-covariance matrix used to compute uncertainty estimates +(e.g., for robust standard errors). This argument accepts a covariance +matrix, a function which returns a covariance matrix, or a string which +identifies the function to be used to compute the covariance matrix. \itemize{ -\item \code{digits}, \code{p_digits}, \code{ci_digits} and \code{footer_digits} to set the number of -digits for the output. \code{groups} can be used to group coefficients. These -arguments will be passed to the print-method, or can directly be used in -\code{print()}, see documentation in \code{\link[=print.parameters_model]{print.parameters_model()}}. -\item If \code{s_value = TRUE}, the p-value will be replaced by the S-value in the -output (cf. \emph{Rafi and Greenland 2020}). -\item \code{pd} adds an additional column with the \emph{probability of direction} (see -\code{\link[bayestestR:p_direction]{bayestestR::p_direction()}} for details). Furthermore, see 'Examples' for -this function. -\item For developers, whose interest mainly is to get a "tidy" data frame of -model summaries, it is recommended to set \code{pretty_names = FALSE} to speed -up computation of the summary table. +\item A covariance matrix +\item A function which returns a covariance matrix (e.g., \code{stats::vcov()}) +\item A string which indicates the kind of uncertainty estimates to return. +\itemize{ +\item Heteroskedasticity-consistent: \code{"HC"}, \code{"HC0"}, \code{"HC1"}, \code{"HC2"}, +\code{"HC3"}, \code{"HC4"}, \code{"HC4m"}, \code{"HC5"}. See \code{?sandwich::vcovHC} +\item Cluster-robust: \code{"CR"}, \code{"CR0"}, \code{"CR1"}, \code{"CR1p"}, \code{"CR1S"}, +\code{"CR2"}, \code{"CR3"}. See \code{?clubSandwich::vcovCR} +\item Bootstrap: \code{"BS"}, \code{"xy"}, \code{"residual"}, \code{"wild"}, \code{"mammen"}, +\code{"fractional"}, \code{"jackknife"}, \code{"norm"}, \code{"webb"}. See +\code{?sandwich::vcovBS} +\item Other \code{sandwich} package functions: \code{"HAC"}, \code{"PC"}, \code{"CL"}, \code{"OPG"}, +\code{"PL"}. +} }} -\item{ci}{Confidence Interval (CI) level. Default to \code{0.95} (\verb{95\%}).} +\item{vcov_args}{List of arguments to be passed to the function identified by +the \code{vcov} argument. This function is typically supplied by the +\strong{sandwich} or \strong{clubSandwich} packages. Please refer to their +documentation (e.g., \code{?sandwich::vcovHAC}) to see the list of available +arguments. If no estimation type (argument \code{type}) is given, the default +type for \code{"HC"} equals the default from the \strong{sandwich} package; for type +\code{"CR"}, the default is set to \code{"CR3"}.} \item{bootstrap}{Should estimates be based on bootstrapped model? If \code{TRUE}, then arguments of \link[=model_parameters.stanreg]{Bayesian regressions} apply (see also @@ -129,12 +99,6 @@ possible adjustment methods are \code{"tukey"}, \code{"scheffe"}, \code{"sidak"} and \code{"none"} to explicitly disable adjustment for \code{emmGrid} objects (from \strong{emmeans}).} -\item{summary}{Deprecated, please use \code{info} instead.} - -\item{include_info}{Logical, if \code{TRUE}, prints summary information about the -model (model formula, number of observations, residual standard deviation -and more).} - \item{keep}{Character containing a regular expression pattern that describes the parameters that should be included (for \code{keep}) or excluded (for \code{drop}) in the returned data frame. \code{keep} may also be a @@ -159,40 +123,25 @@ names.} \item{verbose}{Toggle warnings and messages.} -\item{vcov}{Variance-covariance matrix used to compute uncertainty estimates -(e.g., for robust standard errors). This argument accepts a covariance -matrix, a function which returns a covariance matrix, or a string which -identifies the function to be used to compute the covariance matrix. -\itemize{ -\item A covariance matrix -\item A function which returns a covariance matrix (e.g., \code{stats::vcov()}) -\item A string which indicates the kind of uncertainty estimates to return. +\item{...}{Arguments passed to or from other methods. For instance, when +\code{bootstrap = TRUE}, arguments like \code{type} or \code{parallel} are passed down to +\code{bootstrap_model()}. + +Further non-documented arguments are: \itemize{ -\item Heteroskedasticity-consistent: \code{"HC"}, \code{"HC0"}, \code{"HC1"}, \code{"HC2"}, -\code{"HC3"}, \code{"HC4"}, \code{"HC4m"}, \code{"HC5"}. See \code{?sandwich::vcovHC} -\item Cluster-robust: \code{"CR"}, \code{"CR0"}, \code{"CR1"}, \code{"CR1p"}, \code{"CR1S"}, -\code{"CR2"}, \code{"CR3"}. See \code{?clubSandwich::vcovCR} -\item Bootstrap: \code{"BS"}, \code{"xy"}, \code{"residual"}, \code{"wild"}, \code{"mammen"}, -\code{"fractional"}, \code{"jackknife"}, \code{"norm"}, \code{"webb"}. See -\code{?sandwich::vcovBS} -\item Other \code{sandwich} package functions: \code{"HAC"}, \code{"PC"}, \code{"CL"}, \code{"OPG"}, -\code{"PL"}. -} +\item \code{digits}, \code{p_digits}, \code{ci_digits} and \code{footer_digits} to set the number of +digits for the output. \code{groups} can be used to group coefficients. These +arguments will be passed to the print-method, or can directly be used in +\code{print()}, see documentation in \code{\link[=print.parameters_model]{print.parameters_model()}}. +\item If \code{s_value = TRUE}, the p-value will be replaced by the S-value in the +output (cf. \emph{Rafi and Greenland 2020}). +\item \code{pd} adds an additional column with the \emph{probability of direction} (see +\code{\link[bayestestR:p_direction]{bayestestR::p_direction()}} for details). Furthermore, see 'Examples' for +this function. +\item For developers, whose interest mainly is to get a "tidy" data frame of +model summaries, it is recommended to set \code{pretty_names = FALSE} to speed +up computation of the summary table. }} - -\item{vcov_args}{List of arguments to be passed to the function identified by -the \code{vcov} argument. This function is typically supplied by the -\strong{sandwich} or \strong{clubSandwich} packages. Please refer to their -documentation (e.g., \code{?sandwich::vcovHAC}) to see the list of available -arguments. If no estimation type (argument \code{type}) is given, the default -type for \code{"HC"} equals the default from the \strong{sandwich} package; for type -\code{"CR"}, the default is set to \code{"CR3"}.} - -\item{component}{Should all parameters, parameters for the conditional model, -for the zero-inflation part of the model, or the dispersion model be returned? -Applies to models with zero-inflation and/or dispersion component. \code{component} -may be one of \code{"conditional"}, \code{"zi"}, \code{"zero-inflated"}, \code{"dispersion"} or -\code{"all"} (default). May be abbreviated.} } \value{ A data frame of indices related to the model's parameters. @@ -244,6 +193,9 @@ Some model classes also allow rather uncommon options. These are: \item \strong{mvord}: \code{"thresholds"} and \code{"correlation"} \item \strong{clm2}: \code{"scale"} \item \strong{selection}: \code{"selection"}, \code{"outcome"}, and \code{"auxiliary"} +\item \strong{lavaan}: One or more of \code{"regression"}, \code{"correlation"}, \code{"loading"}, +\code{"variance"}, \code{"defined"}, or \code{"mean"}. Can also be \code{"all"} to include +all components. } For models of class \code{brmsfit} (package \strong{brms}), even more options are diff --git a/man/model_parameters.principal.Rd b/man/model_parameters.principal.Rd index 0d71c3af6..bd221a0e7 100644 --- a/man/model_parameters.principal.Rd +++ b/man/model_parameters.principal.Rd @@ -1,32 +1,9 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/methods_FactoMineR.R, R/methods_lavaan.R, -% R/methods_psych.R -\name{model_parameters.PCA} -\alias{model_parameters.PCA} -\alias{model_parameters.lavaan} +% Please edit documentation in R/methods_psych.R +\name{model_parameters.principal} \alias{model_parameters.principal} \title{Parameters from PCA, FA, CFA, SEM} \usage{ -\method{model_parameters}{PCA}( - model, - sort = FALSE, - threshold = NULL, - labels = NULL, - verbose = TRUE, - ... -) - -\method{model_parameters}{lavaan}( - model, - ci = 0.95, - standardize = FALSE, - component = c("regression", "correlation", "loading", "defined"), - keep = NULL, - drop = NULL, - verbose = TRUE, - ... -) - \method{model_parameters}{principal}( model, sort = FALSE, @@ -50,12 +27,10 @@ structure).} \item{labels}{A character vector containing labels to be added to the loadings data. Usually, the question related to the item.} -\item{verbose}{Toggle warnings and messages.} +\item{verbose}{Toggle warnings.} \item{...}{Arguments passed to or from other methods.} -\item{ci}{Confidence Interval (CI) level. Default to \code{0.95} (\verb{95\%}).} - \item{standardize}{Return standardized parameters (standardized coefficients). Can be \code{TRUE} (or \code{"all"} or \code{"std.all"}) for standardized estimates based on both the variances of observed and latent variables; @@ -67,28 +42,6 @@ exogenous covariates. See \code{lavaan::standardizedsolution} for details.} \item{component}{What type of links to return. Can be \code{"all"} or some of \code{c("regression", "correlation", "loading", "variance", "mean")}.} - -\item{keep}{Character containing a regular expression pattern that -describes the parameters that should be included (for \code{keep}) or excluded -(for \code{drop}) in the returned data frame. \code{keep} may also be a -named list of regular expressions. All non-matching parameters will be -removed from the output. If \code{keep} is a character vector, every parameter -name in the \emph{"Parameter"} column that matches the regular expression in -\code{keep} will be selected from the returned data frame (and vice versa, -all parameter names matching \code{drop} will be excluded). Furthermore, if -\code{keep} has more than one element, these will be merged with an \code{OR} -operator into a regular expression pattern like this: \code{"(one|two|three)"}. -If \code{keep} is a named list of regular expression patterns, the names of the -list-element should equal the column name where selection should be -applied. This is useful for model objects where \code{model_parameters()} -returns multiple columns with parameter components, like in -\code{\link[=model_parameters.lavaan]{model_parameters.lavaan()}}. Note that the regular expression pattern -should match the parameter names as they are stored in the returned data -frame, which can be different from how they are printed. Inspect the -\verb{$Parameter} column of the parameters table to get the exact parameter -names.} - -\item{drop}{See \code{keep}.} } \value{ A data frame of indices or loadings. diff --git a/man/model_parameters.zcpglm.Rd b/man/model_parameters.zcpglm.Rd index d80b43944..d46fe2b74 100644 --- a/man/model_parameters.zcpglm.Rd +++ b/man/model_parameters.zcpglm.Rd @@ -171,6 +171,9 @@ Some model classes also allow rather uncommon options. These are: \item \strong{mvord}: \code{"thresholds"} and \code{"correlation"} \item \strong{clm2}: \code{"scale"} \item \strong{selection}: \code{"selection"}, \code{"outcome"}, and \code{"auxiliary"} +\item \strong{lavaan}: One or more of \code{"regression"}, \code{"correlation"}, \code{"loading"}, +\code{"variance"}, \code{"defined"}, or \code{"mean"}. Can also be \code{"all"} to include +all components. } For models of class \code{brmsfit} (package \strong{brms}), even more options are diff --git a/man/p_value.Rd b/man/p_value.Rd index 8226f6c93..350b3a5cc 100644 --- a/man/p_value.Rd +++ b/man/p_value.Rd @@ -297,6 +297,9 @@ Some model classes also allow rather uncommon options. These are: \item \strong{mvord}: \code{"thresholds"} and \code{"correlation"} \item \strong{clm2}: \code{"scale"} \item \strong{selection}: \code{"selection"}, \code{"outcome"}, and \code{"auxiliary"} +\item \strong{lavaan}: One or more of \code{"regression"}, \code{"correlation"}, \code{"loading"}, +\code{"variance"}, \code{"defined"}, or \code{"mean"}. Can also be \code{"all"} to include +all components. } For models of class \code{brmsfit} (package \strong{brms}), even more options are diff --git a/man/simulate_model.Rd b/man/simulate_model.Rd index f8d2392fc..4c75affd0 100644 --- a/man/simulate_model.Rd +++ b/man/simulate_model.Rd @@ -85,6 +85,9 @@ Some model classes also allow rather uncommon options. These are: \item \strong{mvord}: \code{"thresholds"} and \code{"correlation"} \item \strong{clm2}: \code{"scale"} \item \strong{selection}: \code{"selection"}, \code{"outcome"}, and \code{"auxiliary"} +\item \strong{lavaan}: One or more of \code{"regression"}, \code{"correlation"}, \code{"loading"}, +\code{"variance"}, \code{"defined"}, or \code{"mean"}. Can also be \code{"all"} to include +all components. } For models of class \code{brmsfit} (package \strong{brms}), even more options are diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 1f99a8fe6..8d019d84a 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -45,7 +45,6 @@ reference: - ci.default - p_value - degrees_of_freedom - - n_parameters - subtitle: "Approximation Methods" contents: - p_value_kenward @@ -104,6 +103,10 @@ reference: - parameters_type - print_md + - title: "Functions exported from other packages" + contents: + - n_parameters + - title: "Example Data Sets" contents: - qol_cancer