fmt_record_num: Get record number of initial estimates

View source: R/initial-estimates.R

fmt_record_numR Documentation

Get record number of initial estimates

Description

Get record number of initial estimates

Usage

fmt_record_num(inits)

Arguments

inits

initial estimates object as returned by ⁠nmrec::extract_*⁠ functions. Should be a vector or matrix with nmrec_record_size attributes.

Details

attr(inits, "nmrec_record_size") stores a vector of sizes, one for each occurrence of a given record type. This function creates a vector indicating which record the initial estimate belongs to, and correlates to the order of the initial estimates.

  • For THETA records, this is simply rep(seq_along(sizes), sizes)

  • For OMEGA or SIGMA records, it's a bit more complicated. Here we need to subset the columns (not the rows) of the full lower triangular matrix to update the size to include values created when diagonally concatenating multiple matrix-type records.

This function is intended to be used with matrix_to_df() for matrix-type records.

Value

a vector indicating the which record the initial estimate belongs to


metrumresearchgroup/rbabylon documentation built on April 21, 2024, 3:26 a.m.