sem-in-r / seminr

Natural feeling domain-specific language for building structural equation models in R for estimation by covariance-based methods (like LISREL/Lavaan) or partial least squares (like SmartPLS)
58 stars 19 forks source link

interaction_term() errors when apply a quadratic with 1 IV only #327

Open NicholasDanks opened 1 year ago

NicholasDanks commented 1 year ago
comp_sm <- relationships(
    paths(from = c("X","X*X"),        to = c("Y"))
  )
 twos_mm <- constructs(
    composite("X",     multi_items("x", 1:4), mode_A),
    composite("Y",      multi_items("y", 1:4)),
    interaction_term("X","X", method = two_stage)
  )
  twos_pls_model <- estimate_pls(data = dat,
                                 measurement_model = twos_mm,
                                 structural_model = comp_sm)

Yields:

Generating the seminr model
Error in structural_model[, 1] : incorrect number of dimensions
soumyaray commented 1 year ago

Instead of modifying this function, how about writing a new quadratic_term() function that adapts it instead?