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

Simply extracting random effects variances #720

Merged
merged 46 commits into from
Jun 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
395895d
Update extract_random_variances.R
strengejacke May 31, 2022
e3a2104
Update extract_random_variances.R
strengejacke May 31, 2022
5016d90
Update extract_random_variances.R
strengejacke May 31, 2022
04bdc96
fix order
strengejacke Jun 1, 2022
739659a
Update test-random_effects_ci.R
strengejacke Jun 1, 2022
18247df
Update test-random_effects_ci.R
strengejacke Jun 1, 2022
2aa07f8
fix minor issues
strengejacke Jun 1, 2022
72af758
Update DESCRIPTION
strengejacke Jun 1, 2022
1f1f73e
Update extract_random_variances.R
strengejacke Jun 1, 2022
0a28e47
fix issues for uncorrelated random slopes
strengejacke Jun 1, 2022
e0508c4
Merge branch 'main' into simplify_re_vars
strengejacke Jun 2, 2022
7d554cf
fix glmmadaptive checks
strengejacke Jun 2, 2022
6c98c30
Update test-glmer.R
strengejacke Jun 2, 2022
4b75b7f
Update test-GLMMadaptive.R
strengejacke Jun 2, 2022
7901a3a
Update test-glmmTMB.R
strengejacke Jun 2, 2022
ecd5cb5
Update test-glmmTMB.R
strengejacke Jun 2, 2022
fa98a9c
Update test-glmmTMB.R
strengejacke Jun 2, 2022
6a44618
Update test-glmmTMB.R
strengejacke Jun 2, 2022
3ff8a06
Update test-model_parameters.blmerMod.R
strengejacke Jun 2, 2022
55e3d3e
Update utils_format.R
strengejacke Jun 2, 2022
53ce298
Merge branch 'main' into simplify_re_vars
strengejacke Jun 2, 2022
962ae3d
Merge branch 'main' into simplify_re_vars
strengejacke Jun 7, 2022
17bf521
Update DESCRIPTION
strengejacke Jun 7, 2022
f20e56c
Update extract_random_variances.R
strengejacke Jun 7, 2022
a34f1e9
fix tests for glmmTMB CI
strengejacke Jun 7, 2022
a5c7239
don't fail on older glmmTMB
strengejacke Jun 7, 2022
fade7f6
remove old code, acticate new workhorse
strengejacke Jun 7, 2022
39e06a1
fix lme-issues
strengejacke Jun 7, 2022
434f656
Update test-random_effects_ci-glmmTMB.R
strengejacke Jun 7, 2022
81668a2
Update test-random_effects_ci.R
strengejacke Jun 7, 2022
6bb401a
works locally...
strengejacke Jun 8, 2022
455761f
just some comments
strengejacke Jun 8, 2022
50551d9
increase tolerance
strengejacke Jun 8, 2022
1d6451f
...
strengejacke Jun 8, 2022
a3e3318
Merge branch 'main' into simplify_re_vars
strengejacke Jun 9, 2022
dc99486
Merge branch 'main' into simplify_re_vars
strengejacke Jun 9, 2022
e2124f3
Merge branch 'main' into simplify_re_vars
strengejacke Jun 14, 2022
bc99ed0
Merge branch 'main' into simplify_re_vars
strengejacke Jun 15, 2022
a73f18e
Merge branch 'main' into simplify_re_vars
strengejacke Jun 16, 2022
0fb4913
Merge branch 'main' into simplify_re_vars
strengejacke Jun 17, 2022
d70c256
try so solution for remotes
IndrajeetPatil Jun 18, 2022
a82c1c5
Update DESCRIPTION
IndrajeetPatil Jun 18, 2022
db87e73
Update test-random_effects_ci.R
strengejacke Jun 18, 2022
a1293db
Merge branch 'main' into simplify_re_vars
strengejacke Jun 18, 2022
2b3b353
fix tests
strengejacke Jun 19, 2022
d0540fd
Update utils_model_parameters.R
strengejacke Jun 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,17 @@ Language: en-US
RoxygenNote: 7.2.0
Config/testthat/edition: 3
Roxygen: list(markdown = TRUE)
Remotes: easystats/insight
Remotes:
easystats/insight
RemoteType: github
RemoteHost: api.github.com
RemoteRepo: glmmTMB
RemoteUsername: glmmTMB
RemoteRef: ci_tweaks
RemoteSha: fd8bb78acd8b198147285ce94b1f67043349f570
RemoteSubdir: glmmTMB
GithubRepo: glmmTMB
GithubUsername: glmmTMB
GithubRef: ci_tweaks
GithubSHA1: fd8bb78acd8b198147285ce94b1f67043349f570
GithubSubdir: glmmTMB
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(as.data.frame,VarCorr.lme)
S3method(as.data.frame,glmmTMB)
S3method(as.data.frame,lm)
S3method(as.data.frame,merMod)
Expand Down
11 changes: 11 additions & 0 deletions R/1_model_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ model_parameters.default <- function(model,
verbose = verbose
)

# extract model parameters table, as data frame
out <- tryCatch(
{
.model_parameters_generic(
Expand Down Expand Up @@ -470,6 +471,7 @@ model_parameters.default <- function(model,
}
)

# tell user if something went wrong...
if (length(out) == 1 && isTRUE(is.na(out))) {
msg <- insight::format_message(
paste0("Sorry, `model_parameters()` failed with the following error (possible class '", class(model)[1], "' not supported):\n"),
Expand All @@ -485,6 +487,12 @@ model_parameters.default <- function(model,
}




# helper function for the composition of the parameters table,
# including a bunch of attributes required for further processing
# (like printing etc.)

.model_parameters_generic <- function(model,
ci = .95,
bootstrap = FALSE,
Expand Down Expand Up @@ -527,6 +535,7 @@ model_parameters.default <- function(model,
)
args <- c(args, dots)
params <- do.call("bootstrap_parameters", args)

} else {
# set default method for CI
if (is.null(ci_method) || missing(ci_method)) {
Expand All @@ -552,10 +561,12 @@ model_parameters.default <- function(model,
params <- do.call(".extract_parameters_generic", args)
}

# exponentiate coefficients and SE/CI, if requested
if (isTRUE(exponentiate) || identical(exponentiate, "nongaussian")) {
params <- .exponentiate_parameters(params, model, exponentiate)
}

# add further information as attributes
params <- .add_model_parameters_attributes(
params,
model,
Expand Down
21 changes: 5 additions & 16 deletions R/extract_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@


# ==== degrees of freedom

if (!is.null(ci_method)) {
df_error <- degrees_of_freedom(model, method = ci_method, verbose = FALSE)
} else {
Expand Down Expand Up @@ -310,24 +311,12 @@

.add_sigma_residual_df <- function(params, model) {
if (is.null(params$Component) || !"sigma" %in% params$Component) {
sig <- tryCatch(
{
suppressWarnings(insight::get_sigma(model, ci = NULL, verbose = FALSE))
},
error = function(e) {
NULL
}
)
sig <- tryCatch(suppressWarnings(insight::get_sigma(model, ci = NULL, verbose = FALSE)),
error = function(e) NULL)
attr(params, "sigma") <- as.numeric(sig)

resdf <- tryCatch(
{
suppressWarnings(insight::get_df(model, type = "residual"))
},
error = function(e) {
NULL
}
)
resdf <- tryCatch(suppressWarnings(insight::get_df(model, type = "residual")),
error = function(e) NULL)
attr(params, "residual_df") <- as.numeric(resdf)
}
params
Expand Down
Loading