Data for TMB
Fit
Arguments
- formula_parts
(
mmrm_tmb_formula_parts
)
list with formula parts fromh_mmrm_tmb_formula_parts()
.- data
(
data.frame
)
which contains variables used informula_parts
.- weights
(
vector
)
weights to be used in the fitting process.- reml
(
flag
)
whether restricted maximum likelihood (REML) estimation is used, otherwise maximum likelihood (ML) is used.- accept_singular
(
flag
)
whether below full rank design matrices are reduced to full rankx_matrix
and remaining coefficients will be missing as perx_cols_aliased
. Otherwise the function fails for rank deficient design matrices.- drop_visit_levels
(
flag
)
whether to drop levels for visit variable, if visit variable is a factor.
Value
List of class mmrm_tmb_data
with elements:
full_frame
:data.frame
withn
rows containing all variables needed in the model.x_matrix
:matrix
withn
rows andp
columns specifying the overall design matrix.x_cols_aliased
:logical
with potentially more thanp
elements indicating which columns in the original design matrix have been left out to obtain a full rankx_matrix
.y_vector
: lengthn
numeric
specifying the overall response vector.weights_vector
: lengthn
numeric
specifying the weights vector.visits_zero_inds
: lengthn
integer
containing zero-based visits indices.n_visits
:int
with the number of visits, which is the dimension of the covariance matrix.n_subjects
:int
with the number of subjects.subject_zero_inds
: lengthn_subjects
integer
containing the zero-based start indices for each subject.subject_n_visits
: lengthn_subjects
integer
containing the number of observed visits for each subjects. So the sum of this vector equalsn
.cov_type
:string
value specifying the covariance type.is_spatial_int
:int
specifying whether the covariance structure is spatial(1) or not(0).reml
:int
specifying whether REML estimation is used (1), otherwise ML (0).subject_groups
:factor
specifying the grouping for each subject.n_groups
:int
with the number of total groups
Details
Note that the subject_var
must not be factor but can also be character.
If it is character, then it will be converted to factor internally. Here
the levels will be the unique values, sorted alphabetically and numerically if there
is a common string prefix of numbers in the character elements. For full control
on the order please use a factor.