c.partables {modelbpp}R Documentation

Manipulate Parameter Tables

Description

Functions to manipulate a partables-class object

Usage

## S3 method for class 'partables'
c(...)

## S3 method for class 'model_set'
c(...)

partables_drop(x, model_names = NULL)

Arguments

...

An arbitrary number of objects. All invalid objects (see details) will be discarded. If an object is named and is not partables object, its name will be used.

x

A partables-class object.

model_names

A character vector of the names of models in a partables-class object.

Details

The partables-class objects have a c() method that can be used to combine parameter tables. Each object must be

a. a partables-class object, b. a model_set-class object, c. a lavaan-class object, or d. a parameter table of the class lavaan.data.frame(), usually generated by lavaan::parameterTable(). Other objects will be discarded.

Names will be used when combining objects. If two objects have the same names, then only the first one will be retained. No warning message will be issued. Users are encouraged to explicitly name all objects carefully.

Note that, to invoke this method, the first object must be a partables object.

The model_set class also has a c-method. It will replace the first object by the stored partables and then call the c-method of partables objects.

The function partables_drop() is for dropping models from a partables-class object.

Value

A partables-class objects with all the objects supplied combined together. If an object is a lavaan-class object, its parameter table will be retrieved by lavaan::parameterTable(). If an object is a model_set-class object, the stored partables-class object will be retrieved.

Author(s)

Shu Fai Cheung https://orcid.org/0000-0002-9871-9448

Examples


library(lavaan)

moda <-
"
x3 ~ a*x1 + b*x2
x4 ~ a*x1
ab := a*b
"

fita <- sem(moda, dat_path_model, fixed.x = TRUE)

outa <- model_set(fita,
                  progress = FALSE,
                  parallel = FALSE)

modb <-
"
x3 ~ a*x1 + b*x2
x4 ~ a*x2
ab := a*b
"

fitb <- sem(modb, dat_path_model, fixed.x = TRUE)

outb <- model_set(fitb,
                  progress = FALSE,
                  parallel = FALSE)

mod2 <-
"
x2 ~ 0*x3 + 0*x4
x1 ~ 0*x3
"
fit2 <- sem(mod2, dat_path_model)

mod3 <-
"
x2 ~ x3 + 0*x4
x1 ~ x3
"
fit3 <- sem(mod3, dat_path_model)

out <- c(outa$models, user2 = fit2, outb$models, user3 = fit3)
out

out2 <- c(outa, user2 = fit2, outb$models, user3 = fit3)
out2

out3 <- c(outa, user2 = fit2, outb, user3 = fit3)
out3


[Package modelbpp version 0.1.3 Index]