dt2mat: Convert a data.table of parameter estimates to a matrix

View source: R/dt2mat.R

dt2matR Documentation

Convert a data.table of parameter estimates to a matrix

Description

Often needed when using estimates of Omega or Sigma matrices in further calculations.

Usage

dt2mat(pars, dt.subset = "unique", max.i, fill = 0, col.value)

Arguments

pars

A data.table with parameters. Must contain columns 'i' and 'j' with row and column indexes and 'est' with parameter (matrix) values.

dt.subset

Specifies whether pars contains only a lower or upper triangle of an assumed symmetric matrix (most often the case for variance-covariance matrices), or it contains the full matrix. 'dt.subset="unique"' (default) means that 'pars' only contains either upper or lower diagonal matrix (including diagonal), 'dt.subset="all"' means 'pars' contains both upper and lower triangles. See details.

max.i

By default, the maximum row number is derived as he maximum value in the 'i' column. If more (empty ones) are needed, specify the maximum row number with 'max.i'. This can be necessary in cases where only estimated elements are available but a full matrix including elements related to fixed parameters is needed.

fill

Value to insert for missing elements

col.value

The name of the column from which to take the 'OMEGA' values. Default is "value" in alignment with the output from 'NMreadExt()'.

Details

If pars does not contain all 'i' values, they will be imputed with zeros. The desired matrix dimension is inferred from 'min(i)' and 'max(i)'. In case 'dt.subset=="unique"' missing 'j' elements will also give imputations of missing elements.

Value

a matrix


philipdelff/NMdata documentation built on March 5, 2025, 12:20 a.m.