get_stv: extract parameter estimates as named vector

View source: R/hyreg2.R

get_stvR Documentation

extract parameter estimates as named vector

Description

function to export coefficient values and names from a model fitted with hyreg2 or hyreg2_het These values can be used as stv for a new model with k > 1

Usage

get_stv(mod, comp = "Comp.1")

Arguments

mod

modeloutput from hyreg2 oder hyreg2_het. If latent was "cont" or "dich" only one element of the output list can be used.

comp

charachter, default "Comp.1". "Comp.x" indicating values from which model component (x) should be exported

Value

⁠named vector⁠ of parameter estimates from mod. Can be used as stv for additional model estimations using hyreg2 or hyreg2_het

Author(s)

Svenja Elkenkamp

Examples

formula <- y ~  -1 + x1 + x2 + x3 | id

k <- 1
stv <- setNames(c(0.2,0,1,1,1),c(colnames(simulated_data_norm)[3:5],c("sigma","theta")))
control = list(iter.max = 1000, verbose = 4)
rm(counter)
mod <- hyreg2(formula = formula,
                    data =  simulated_data_norm,
                    type =  simulated_data_norm$type,
                    stv = stv,
                    k = k,
                    type_cont = "TTO",
                    type_dich = "DCE_A",
                    opt_method = "L-BFGS-B",
                    control = control,
                    latent = "both",
                    id_col = "id"
)
new_stv <- get_stv(mod)

# these new_stv can be used in an other estimation using hyreg2 as stv

hyreg2 documentation built on Nov. 5, 2025, 7:38 p.m.

Related to get_stv in hyreg2...