author: Roberta De Vito, Alejandra Avalos-Pacheco
Fit the Multi-Study Factor Regression model via the ECM algorithm.
The following example illustrates how to fit the MSFR model via the ECM Algorithm, using a data set generating from a simulation scenario.
library(MSFR)
data(Scenario1_MSFR.rda)
Then we get inizialization for model parameters, with q=3 common factors and q_s=1 study-specific factors for two studies (S=2).
start_value <- start_msfa(X_s, B_s, p_b, k, j_s, constraint = "block_lower2", method = "adhoc")
Now we can proceed for estimating the model parameters via the ECM algorithm
ECM_MSFR <- ecm_msfa(X_s, B_s, start=start_value, nIt = 10000, trace = FALSE)
The estimated matrix of common loadings can be visualized
Phi <- ECM_MSFR$Phi
The estimated matrix of study-specific loadings can be visualized
```{r get spec, results = FALSE}
Lambda_1 <- ECM_MSFR$Lambda_s[[1]]
Lambda_2 <- ECM_MSFR$Lambda_s[[2]]
The estimated matrix of regression coefficients for covariates effect can be visualized
```{r get cov, results = FALSE}
beta <- ECM_MSFR$$beta