Skip to contents

Extracts variance-covariance or correlation matrix from a brokenstick object.

Usage

get_omega(x, what = c("cov", "cor"), names = NULL)

Arguments

x

Object of class brokenstick

what

Either "cov" (default) for the covariance matrix, or "cor" for the correlation matrix.

names

A vector of column names of. If not specified, the function automatically drops the entries corresponding to the right boundary. Specify names = "all" to prevent dropping.

Value

A numeric matrix, possibly with zero rows and columns if no names match

Examples

f1 <- brokenstick(hgt_z ~ age | id, smocc_200[1:1000, ], knots = 0:3, seed = 1)
get_omega(f1, "cor", c("age_1", "age_2"))
#>           age_1     age_2
#> age_1 1.0000000 0.9147632
#> age_2 0.9147632 1.0000000