Learn R Programming

broom.mixed (version 0.2.9.5)

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

Description

Returns a tibble with the following columns:

group

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

term

terms 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".

estimate

estimated coefficient

estimated

This 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 varFunc
tidy(x, ...)

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

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.

Arguments

x

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

...

Ignored

Examples

Run this code
if (FALSE) {
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))
}
}

Run the code above in your browser using DataLab