Skip to content

tidy.ref_fit

man/tidy.ref_fit.Rd

Also documents
  • glance.ref_fit
  • glance.ref_assessment
  • augment.ref_fit

Usage

tidy.ref_fit(x, ...)
glance.ref_fit(x, ...)
glance.ref_assessment(x, ...)
augment.ref_fit(x, newdata, uncertainty = c("total", "conditional"), ...)

tidy() gives one row per outcome: family, fit status, sample size, total effective degrees of freedom and one edf_<term> column per smooth term, and any engine message. glance() gives one row per fit (or per assessment, averaging the overall and marginal tables over outcomes). augment() returns newdata with .z_<outcome> and .centile_<outcome> columns and the covariate .support; the result can be passed straight to ref_joint().

Argument Description
x A ref_fit or ref_assessment.
... Passed to predict.ref_fit() by augment(); unused
otherwise.
newdata Data frame of target observations.
uncertainty Passed to predict.ref_fit().

A tibble.

ref <- ref_simulate(120, seed = 3)
fit <- ref_fit(ref_spec(ref_gaussian(), ~ s(age, k = 5) + sex), ref, "y")
tidy(fit)
# A tibble: 1 × 7
outcome family status n edf `edf_s(age)` message
<chr> <chr> <chr> <int> <dbl> <dbl> <chr>
1 y gaussian ok 120 3.64 1.64 <NA>
glance(fit)
# A tibble: 1 × 8
family engine n n_outcomes n_ok covariates adapted calibrated
<chr> <chr> <int> <int> <int> <chr> <lgl> <lgl>
1 gaussian mgcv 120 1 1 age, sex FALSE FALSE
augment(fit, ref[1:3, ], uncertainty = "conditional")
# A tibble: 3 × 10
age sex site y marker_01 marker_02 marker_03 .z_y .centile_y
<dbl> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 30.1 M B 8.83 9.45 11.2 9.83 0.0867 0.535
2 68.5 F A 9.98 9.72 9.07 10.1 -0.854 0.196
3 43.1 F A 9.91 9.82 10.6 11.3 0.615 0.731
# ℹ 1 more variable: .support <chr>