Skip to contents

Compute profile-likelihood curves and confidence intervals for random-effects variance parameters by fixing one variance parameter at a time and re-optimizing all remaining parameters.

Usage

profile_random_effects(
  model,
  tau_indices = NULL,
  level = 0.95,
  n_points = 21,
  span = 3,
  grid = NULL,
  optim_method = "L-BFGS-B",
  control = list(factr = 1e+07, maxit = 400)
)

Arguments

model

A fitted mars model object (non-LASSO).

tau_indices

Optional indices (1-based) of random-effects parameters to profile. Defaults to all random-effects parameters.

level

Confidence level for profile-likelihood intervals. Default 0.95.

n_points

Number of grid points used per profiled parameter. Default 21.

span

Multiplicative span around the MLE for automatic grids. Default 3.

grid

Optional custom grid specification:

  • numeric vector: reused for each parameter

  • list of numeric vectors with one entry per profiled parameter.

optim_method

Optimization method passed to optim(). Default "L-BFGS-B".

control

Control list passed to optim() for each conditional fit.

Value

A list containing per-parameter profile grids and profile-likelihood CIs.

Examples

# \donttest{
fit <- mars(
  data = teacher_expectancy,
  studyID = "study",
  effectID = NULL,
  sample_size = NULL,
  formula = yi ~ 1,
  variance = "vi",
  varcov_type = "univariate",
  structure = "univariate"
)
profile_random_effects(fit, n_points = 7)
#> $level
#> [1] 0.95
#> 
#> $cutoff
#> [1] -18.82381
#> 
#> $summary
#>   tau_index        mle    cutoff ci_lower  ci_upper
#> 1         1 0.01881834 -18.82381       NA 0.1052038
#> 
#> $profiles
#> $profiles$tau1
#>   tau_index   tau_value  objective converged
#> 1         1 0.006272779 -22.239639      TRUE
#> 2         1 0.017559931 -22.662301      TRUE
#> 3         1 0.018818336 -22.665270      TRUE
#> 4         1 0.049157030 -21.747528      TRUE
#> 5         1 0.137609516 -17.133346      TRUE
#> 6         1 0.385222199  -7.246192      TRUE
#> 7         1 1.078385755   7.069912      TRUE
#> 8         1 3.018818336  23.862889      TRUE
#> 
#> 
#> attr(,"class")
#> [1] "profile_likelihood" "list"              
# }