The following example illustrates how to fit a MSFA model via the ECM Algorithm, using a data set available in the Bioconductor repository (www.bioconductor.org).
Some pre-processing is required to get the data into a form suitable for the
analysis. This was already done, and the resulting data frame is saved into the
data_immune
object. The commands that were used to form it are included
in the help file for the data object.
library(MSFA) data(data_immune) help(data_immune)
Then we get suitable starting values for model parameters, selecting $K=3$ common factors and $3, 4$ study-specific factors for the two studies, respectively.
start_value <- start_msfa(X_s = data_immune, k = 3, j_s = c(3, 4))
Now everything is in place for estimating the model parameters via the ECM algorithm
mle <- ecm_msfa(data_immune, start_value, trace = FALSE)
The estimated matrix of common loadings can be represented by a suitable heatmap:
library(gplots) heatmap.2(mle$Phi,dendrogram='none', Rowv=FALSE, Colv=FALSE,trace='none', density.info="none", col=heat.colors(256))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.