extract_weights: Function to extract time-varying weights from lWQS object

Description Usage Arguments Value Examples

View source: R/lwqs.R

Description

Function to extract time-varying weights from lWQS object

Usage

1

Arguments

lobj

An object returned from lWQS function

Value

A (long-form) data frame containing the time index and corresponding variable weights estimated in an lWQS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# identify predictor variables used in mixture
mixvars=names(lwqs_data)[5:9]

# run model
model=lwqs(data=lwqs_data,
           timevar="time",
           wqs_parms=list(formula=out ~ wqs,
              data = lwqs_data,
              mix_name=mixvars,
              b1_constr = TRUE,
              b1_pos=TRUE,
              b = 5,
              q = 5,
              validation = 0,
              family = "gaussian",
              seed = 1),
              outcome="out",
              ID="ID")

# use extract_weights to access time-varying predictor weights
timeweights=extract_weights(model)

lwqs documentation built on March 4, 2021, 5:07 p.m.