This function returns an object of class scoreparameters containing the data and parameters needed for calculation of the BDe/BGe score, or a user defined score.
scoreparameters(
scoretype = c("bge", "bde", "bdecat", "usr"),
data,
bgepar = list(am = 1, aw = NULL, edgepf = 1),
bdepar = list(chi = 0.5, edgepf = 2),
bdecatpar = list(chi = 0.5, edgepf = 2),
dbnpar = list(samestruct = TRUE, slices = 2, b = 0, stationary = TRUE, rowids = NULL,
datalist = NULL, learninit = TRUE),
usrpar = list(pctesttype = c("bge", "bde", "bdecat")),
mixedpar = list(nbin = 0),
MDAG = FALSE,
DBN = FALSE,
weightvector = NULL,
bgnodes = NULL,
edgepmat = NULL,
nodeslabels = NULL
)# S3 method for scoreparameters
print(x, ...)
# S3 method for scoreparameters
summary(object, ...)
an object of class scoreparameters
, which includes all necessary information for calculating the BDe/BGe score
the score to be used to assess the DAG structure: "bge" for Gaussian data, "bde" for binary data, "bdecat" for categorical data, "usr" for a user defined score; when "usr" score is chosen, one must define a function (which evaluates the log score of a node given its parents) in the following format: usrDAGcorescore(j,parentnodes,n,param), where 'j' is node to be scores, 'parentnodes' are the parents of this node, 'n' number of nodes in the netwrok and 'param' is an object of class 'scoreparameters'
the data matrix with n columns (the number of variables) and a number of rows equal to the number of observations
a list which contains parameters for BGe score:
am (optional) a positive numerical value, 1 by default
aw (optional) a positive numerical value should be more than n+1
, n+am+1
by default
edgepf (optional) a positive numerical value providing the edge penalization factor to be combined with the BGe score, 1 by default (no penalization)
a list which contains parameters for BDe score for binary data:
chi (optional) a positive number of prior pseudo counts used by the BDe score, 0.5 by default
edgepf (optional) a positive numerical value providing the edge penalization factor to be combined with the BDe score, 2 by default
a list which contains parameters for BDe score for categorical data:
chi (optional) a positive number of prior pseudo counts used by the BDe score, 0.5 by default
edgepf (optional) a positive numerical value providing the edge penalization factor to be combined with the BDe score, 2 by default
which type of score to use for the slices
samestruct logical, when TRUE the structure of the first time slice is assumed to be the same as internal structure of all other time slices
slices integer representing the number of time slices in a DBN
b the number of static variables; all static variables have to be in the first b columns of the data; for DBNs static variables have the same meaning as bgnodes for usual Bayesian networks; for DBNs parameters parameter bgnodes
is ignored
rowids optional vector of time IDs; usefull for identifying data for initial time slice
datalist indicates is data is passed as a list for a two step DBN; useful for unbalanced number of samples in timi slices
a list which contains parameters for the user defined score
pctesttype (optional) conditional independence test ("bde","bge","bdecat")
a list which contains parameters for the BGe and BDe score for mixed data
nbin a positive integer number of binary nodes in the network (the binary nodes are always assumed in first nbin columns of the data)
logical, when TRUE the score is initialized for a model with multiple sets of parameters but the same structure
logical, when TRUE the score is initialized for a dynamic Baysian network; FALSE by default
(optional) a numerical vector of positive values representing the weight of each observation; should be NULL(default) for non-weighted data
(optional) a vector that contains column indices in the data defining the nodes that are forced to be root nodes in the sampled graphs; root nodes are nodes which have no parents but can be parents of other nodes in the network; in case of DBNs bgnodes represent static variables and defined via element b
of the parameters dbnpar
; parameter bgnodes
is ignored for DBNs
(optional) a matrix of positive numerical values providing the per edge penalization factor to be added to the score, NULL by default
(optional) a vector of characters which denote the names of nodes in the Bayesian network; by default column names of the data will be taken
object of class 'scoreparameters'
ignored
object of class 'scoreparameters'
Polina Suter, Jack kuipers
Geiger D and Heckerman D (2002). Parameter priors for directed acyclic graphical models and the characterization of several probability distributions. The Annals of Statistics 30, 1412-1440.
Kuipers J, Moffa G and Heckerman D (2014). Addendum on the scoring of Gaussian acyclic graphical models. The Annals of Statistics 42, 1689-1691.
Heckerman D and Geiger D (1995). Learning Bayesian networks: A unification for discrete and Gaussian domains. In Eleventh Conference on Uncertainty in Artificial Intelligence, pages 274-284.
Scutari M (2016). An Empirical-Bayes Score for Discrete Bayesian Networks. Journal of Machine Learning Research 52, 438-448
myDAG<-pcalg::randomDAG(20, prob=0.15, lB = 0.4, uB = 2)
myData<-pcalg::rmvDAG(200, myDAG)
myScore<-scoreparameters("bge", myData)
Run the code above in your browser using DataLab