Skip to contents

Shared helper for build_conditional_design(), build_conditional_design_copula(), and process_variance(): builds each biomarker's random-effects design from the left-hand side of its own long_sub_random formula (e.g. ~ 1, ~ year, ~ year + I(year^2)) and stacks them block-diagonally, matching the block-diagonal Sigma_fit built by longitudinalSub(). Previously this assumed every biomarker had either a random intercept only, or a random intercept plus a slope on time_variable, so a mix of the two (or any other random-effects formula) failed with "non-conformable arguments".

Usage

random_effects_design(data_num_i_list, long_sub_random, Sigma)

Arguments

data_num_i_list

One patient's data, one data frame per biomarker.

long_sub_random

The list of random-effects formulas.

Sigma

The random-effects covariance matrix (Sigma_fit).

Value

A matrix with one row per observation (stacked across biomarkers) and one column per random effect.