View source: R/latent_factor.R
lfactor | R Documentation |
This function can be used as part of a dynamiteformula()
to define
a common latent factor component. The latent factor is modeled as a spline
similarly as a time-varying intercept, but instead of having equal effect on
each group, there is an additional loading variable for each group so that
in the linear predictor we have a term \lambda_i \psi_t
for each
group i
.
lfactor(
responses = NULL,
nonzero_lambda = TRUE,
correlated = TRUE,
noncentered_psi = FALSE,
flip_sign = TRUE
)
responses |
[ |
nonzero_lambda |
[ |
correlated |
[ |
noncentered_psi |
[ |
flip_sign |
[ |
An object of class latent_factor
.
Model formula construction
dynamite()
,
dynamiteformula()
,
lags()
,
random_spec()
,
splines()
data.table::setDTthreads(1) # For CRAN
# three channel model with common factor affecting for responses x and y
obs(y ~ 1, family = "gaussian") +
obs(x ~ 1, family = "poisson") +
obs(z ~ 1, family = "gaussian") +
lfactor(
responses = c("y", "x"), nonzero_lambda = c(TRUE, FALSE),
correlated = TRUE, noncentered_psi = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.