Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise get_variance.lme()? #206

Open
strengejacke opened this issue Jun 28, 2020 · 0 comments
Open

Revise get_variance.lme()? #206

strengejacke opened this issue Jun 28, 2020 · 0 comments
Labels
3 investigators ❔❓ Need to look further into this issue get_variance function specific labels Low priority 😴 This issue can be easily workaround or happens only in edge cases

Comments

@strengejacke
Copy link
Member

Maybe related to this, we could use this code:

function (mod) 
{
  sigma_sq <- mod$sigma^2
  RE_params <- coef(mod$modelStruct$reStruct, FALSE)
  Tau_params <- RE_params * RE_params^(as.numeric(grepl("sd", 
    attr(RE_params, "names")))) * sigma_sq
  names(Tau_params) <- mapply(gsub, ".sd", ".var", names(Tau_params), 
    USE.NAMES = FALSE)
  cor_params <- as.double(coef(mod$modelStruct$corStruct, 
    FALSE))
  var_params <- as.double(coef(mod$modelStruct$varStruct, 
    FALSE))
  group_names <- names(mod$groups)
  Tau_param_list <- sapply(group_names, function(x) Tau_params[grep(x, 
    names(Tau_params))], simplify = FALSE, USE.NAMES = TRUE)
  fixed_sigma <- attr(mod$modelStruct, "fixedSigma")
  sigma_sq <- if (fixed_sigma) 
    NULL
  else sigma_sq
  varcomp <- list(Tau = Tau_param_list, cor_params = cor_params, 
    var_params = var_params, sigma_sq = sigma_sq)
  class(varcomp) <- "varcomp"
  return(varcomp)
}

Originally posted by @strengejacke in #188 (comment)

@strengejacke strengejacke added the 3 investigators ❔❓ Need to look further into this issue label Jun 28, 2020
@strengejacke strengejacke added the Low priority 😴 This issue can be easily workaround or happens only in edge cases label Mar 25, 2021
@strengejacke strengejacke added the get_variance function specific labels label Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 investigators ❔❓ Need to look further into this issue get_variance function specific labels Low priority 😴 This issue can be easily workaround or happens only in edge cases
Projects
None yet
Development

No branches or pull requests

1 participant