mgmfit(data, type, lev, lambda.sel = "EBIC", folds = 10,
gam = .25, d=2, rule.reg = "AND", pbar = TRUE,
method = "glm", missings = 'error', weights = NA,
ret.warn = TRUE, binary.sign = FALSE)
lev=1
for all continuous variables)
lambda.sel="CV"
. Defaults to folds=10
.lambda.sel="EBIC"
. Defaults to gam=.25
(Barber et al., 2015).
method = "glm"
uses the appropriate link function for each variable type. method = "linear"
uses linear regression for each variable, no matter of which type it is (for categorical variables, this method predicts each indicator variable using linear regression).missings = 'error'
returns an error message in case there are missing data. missings = 'casewise.zw'
sets the weight of missing cases to zero. For stationary graphs, this is the equivalent to casewise deletion. In time varying graphs, this avoids corruption of the time scale, which would be the consequence of casewise deletion. For details, please see Haslbeck and Waldorp (2015).FALSE
warnings are surpressed.binary.sign = TRUE
and if the binary variable is in (0,1) then the sign of this interaction will be recovered and returned in the sign matrix (see below).wadj
. If there are categorical variables in the dataset, the matrix has the dimensions of the overcomplete representations. NA values indicate parameters that are not estimated (because they are redundant). For details see Friedman, Hastie and Tibshirani (2010).signs
matrix, however, contains color names. This is useful for plotting the graphical model (for instance with the qgraph package) and indicating the sign (negative = red, positive = green, undefined = grey) for each edge in the graph.mpar.matrix
indicating which parameter belongs to the interaction between which variables.(ret.warn = TRUE)
.Friedman, J., Hastie, T., & Tibshirani, R. (2010). Regularization paths for generalized linear models via coordinate descent. Journal of statistical software, 33(1), 1. Chicago.
Haslbeck, J., & Waldorp, L. J. (2015). Structure estimation for mixed graphical models in high-dimensional data. arXiv preprint arXiv:1510.05677.
Loh, P. L., & Wainwright, M. J. (2013). Structure estimation for discrete graphical models: Generalized covariance matrices and their inverses. The Annals of Statistics, 41(6), 3022-3049.
Yang, E., Baker, Y., Ravikumar, P., Allen, G., & Liu, Z. (2014). Mixed graphical models via exponential families. In Proceedings of the Seventeenth International Conference on Artificial Intelligence and Statistics (pp. 1042-1050).
confusion
, mgmsampler
## Not run: ------------------------------------
#
# # Autism example dataset
# dim(autism_data$data)
#
# # Fit mixed graphical model
# fitobj <- mgmfit(data = autism_data$data,
# type = autism_data$type,
# lev = autism_data$lev,
# lambda.sel = 'EBIC')
#
# round(fitobj$wadj,2) # Weighted adjacency matrix
#
# # Visualize the adjacency matrix using the qgraph package
# library(qgraph)
# colnames(fitobj$wadj) <- autism_data$colnames
# qgraph(fitobj$wadj,
# legend=TRUE,
# nodeNames=autism_data$colnames,
# layout='spring',
# edge.color=fitobj$edgecolor)
## ---------------------------------------------
Run the code above in your browser using DataLab