extract_mixture {lwqs}R Documentation

Function to extract time-varying mixture (wqs) index from lWQS object

Description

Function to extract time-varying mixture (wqs) index from lWQS object

Usage

extract_mixture(lobj)

Arguments

lobj

An object returned from lWQS function

Value

Data frame containing the time index, wqs index estimated at each repeated measure, subject ID, and the outcome variable.

Examples


# identify predictor variables used in mixture
mixvars=names(lwqs_data)[5:9]

# run model. Note for example run-time only 1 bootstrap (b=1) is used. Set b to be >50
model=lwqs(data=lwqs_data,
           timevar="time",
           wqs_parms=list(formula=out ~ wqs,
              data = lwqs_data,
              mix_name=mixvars,
              b1_constr = TRUE,
              b1_pos=FALSE,
              b = 5,
              q = 5,
              validation = 0,
              family = "gaussian",
              seed = 1),
              outcome="out",
              ID="ID")

# use extract_mixture to access time-varying wqs index
mixtime=extract_mixture(model)

[Package lwqs version 0.5.0 Index]