From 58dba81bd223abce796797dc192e4e73b0351b34 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 22 Sep 2023 09:46:55 +0200 Subject: [PATCH] fix examples --- R/get_variances.R | 27 +++++++++++++-------------- man/get_variance.Rd | 6 ++++-- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/R/get_variances.R b/R/get_variances.R index a7badbc10..dd4a50edd 100644 --- a/R/get_variances.R +++ b/R/get_variances.R @@ -22,17 +22,16 @@ #' @param ... Currently not used. #' #' @return A list with following elements: -#' \itemize{ -#' \item `var.fixed`, variance attributable to the fixed effects -#' \item `var.random`, (mean) variance of random effects -#' \item `var.residual`, residual variance (sum of dispersion and distribution) -#' \item `var.distribution`, distribution-specific variance -#' \item `var.dispersion`, variance due to additive dispersion -#' \item `var.intercept`, the random-intercept-variance, or between-subject-variance (\ifelse{html}{\out{τ00}}{\eqn{\tau_{00}}}) -#' \item `var.slope`, the random-slope-variance (\ifelse{html}{\out{τ11}}{\eqn{\tau_{11}}}) -#' \item `cor.slope_intercept`, the random-slope-intercept-correlation (\ifelse{html}{\out{ρ01}}{\eqn{\rho_{01}}}) -#' \item `cor.slopes`, the correlation between random slopes (\ifelse{html}{\out{ρ00}}{\eqn{\rho_{00}}}) -#' } +#' +#' - `var.fixed`, variance attributable to the fixed effects +#' - `var.random`, (mean) variance of random effects +#' - `var.residual`, residual variance (sum of dispersion and distribution) +#' - `var.distribution`, distribution-specific variance +#' - `var.dispersion`, variance due to additive dispersion +#' - `var.intercept`, the random-intercept-variance, or between-subject-variance (\ifelse{html}{\out{τ00}}{\eqn{\tau_{00}}}) +#' - `var.slope`, the random-slope-variance (\ifelse{html}{\out{τ11}}{\eqn{\tau_{11}}}) +#' - `cor.slope_intercept`, the random-slope-intercept-correlation (\ifelse{html}{\out{ρ01}}{\eqn{\rho_{01}}}) +#' - `cor.slopes`, the correlation between random slopes (\ifelse{html}{\out{ρ00}}{\eqn{\rho_{00}}}) #' #' @details This function returns different variance components from mixed models, #' which are needed, for instance, to calculate r-squared measures or the @@ -97,10 +96,10 @@ #' } #' #' @note This function supports models of class `merMod` (including models -#' from \pkg{blme}), `clmm`, `cpglmm`, `glmmadmb`, `glmmTMB`, +#' from **blme**), `clmm`, `cpglmm`, `glmmadmb`, `glmmTMB`, #' `MixMod`, `lme`, `mixed`, `rlmerMod`, `stanreg`, #' `brmsfit` or `wbm`. Support for objects of class `MixMod` -#' (\pkg{GLMMadaptive}), `lme` (\pkg{nlme}) or `brmsfit` (\pkg{brms}) +#' (**GLMMadaptive**), `lme` (**nlme**) or `brmsfit` (**brms**) #' is experimental and may not work for all models. #' #' @references @@ -117,7 +116,7 @@ #' and generalized linear mixed models with R. Newburgh, United Kingdom: #' Highland Statistics. #' -#' @examples +#' @examplesIf require("lme4", quietly = TRUE) #' \donttest{ #' library(lme4) #' data(sleepstudy) diff --git a/man/get_variance.Rd b/man/get_variance.Rd index 762a0baaa..912008e91 100644 --- a/man/get_variance.Rd +++ b/man/get_variance.Rd @@ -141,13 +141,14 @@ for mixed models with random intercepts and slopes. } \note{ This function supports models of class \code{merMod} (including models -from \pkg{blme}), \code{clmm}, \code{cpglmm}, \code{glmmadmb}, \code{glmmTMB}, +from \strong{blme}), \code{clmm}, \code{cpglmm}, \code{glmmadmb}, \code{glmmTMB}, \code{MixMod}, \code{lme}, \code{mixed}, \code{rlmerMod}, \code{stanreg}, \code{brmsfit} or \code{wbm}. Support for objects of class \code{MixMod} -(\pkg{GLMMadaptive}), \code{lme} (\pkg{nlme}) or \code{brmsfit} (\pkg{brms}) +(\strong{GLMMadaptive}), \code{lme} (\strong{nlme}) or \code{brmsfit} (\strong{brms}) is experimental and may not work for all models. } \examples{ +\dontshow{if (require("lme4", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \donttest{ library(lme4) data(sleepstudy) @@ -157,6 +158,7 @@ get_variance(m) get_variance_fixed(m) get_variance_residual(m) } +\dontshow{\}) # examplesIf} } \references{ \itemize{