tidy.varFunc: Tidy variance structure for the 'nlme' package.

tidy.varFuncR Documentation

Tidy variance structure for the nlme package.

Description

Returns a tibble with the following columns:

  • grouptype of varFunc, along with the right hand side of the formula in parentheses e.g. "varExp(age | Sex)".

  • termterms included in the formula of the variance model, specifically the names of the coefficients. If the value is fixed, it will be appended with " ; fixed".

  • estimateestimated coefficient

  • estimatedThis column is only included if some parameters are fixed. TRUE if the parameter is estimated and FALSE if the parameter is fixed.

Usage

## S3 method for class 'varFunc'
tidy(x, ...)

## S3 method for class 'varComb'
tidy(x, ...)

Arguments

x

An object of class varFunc, such as those used as the weights argument from the nlme package

...

Ignored

Value

If the varFunc is uninitialized or has no parameters, the function will return an empty tibble. Otherwise, it will return a tibble with names described in the details section.

Examples

## Not run: 
if (require("nlme")) {
ChickWeight_arbitrary_group <- datasets::ChickWeight
ChickWeight_arbitrary_group$group_arb_n <-
  1 + (
    as.integer(ChickWeight_arbitrary_group$Chick) >
    median(as.integer(ChickWeight_arbitrary_group$Chick))
  )
ChickWeight_arbitrary_group$group_arb <- c("low", "high")[ChickWeight_arbitrary_group$group_arb_n]

fit_with_fixed <-
  lme(
    weight ~ Diet * Time,
    random = ~Time | Chick,
    data =ChickWeight_arbitrary_group,
    weights=varIdent(fixed=c("low"=5), form=~1|group_arb)
  )
# Show all parameters
tidy(fit_with_fixed)
# Exclude fixed parameters
tidy(fit_with_fixed) %>%
  filter(across(any_of("estimated"), ~.x))
}

## End(Not run)

broom.mixed documentation built on April 18, 2022, 1:06 a.m.