R/variance_components.R

Defines functions variance_components

## Extract relevant variance components of an lme object

variance_components <- function(model){
  vc <- diag(nlme::getVarCov(model))
  vc <- vc |> as.data.frame() |> t() |> as.data.frame() |>
    dplyr::select(!tidyselect::starts_with("met")[-1]) |>
    dplyr::select(!tidyselect::starts_with("time")[-1])
  se <- model$sigma^2
  return(c(unlist(vc),se))
}

Try the cccrm package in your browser

Any scripts or data that you put into this service are public.

cccrm documentation built on Oct. 19, 2024, 9:06 a.m.