D. Altomare, G. Consonni and L. La Rocca (2013). Objective Bayesian search of Gaussian directed acyclic graphical models for ordered variables with non-local priors. Biometrics.
Examples
data(SimDag6)
Corr=dataSim6$SimCorr[[1]]
nobs=50
q=ncol(Corr)
Gt=dataSim6$TDag
# Regression of Y(q) on Y(q-1),...,Y(1)
Res_search=FBF_RS(Corr, nobs, matrix(0,1,(q-1)), 1, 0.01, 1000, 10)
M_q=Res_search$M_q
M_G=Res_search$M_G
M_P=Res_search$M_P
Mt=rev(matrix(Gt[1:(q-1),q],1,(q-1))) #True Model
M_med=M_q
M_med[M_q>=0.5]=1
M_med[M_q<0.5]=0 #median probability model
sum(sum(abs(M_med-Mt))) #Structural Hamming Distance between the true DAG and the median probability DAG
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(FBFsearch)
Loading required package: Rcpp
Loading required package: RcppArmadillo
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FBFsearch/FBF_RS.Rd_%03d_medium.png", width=480, height=480)
> ### Name: FBF_RS
> ### Title: Moment Fractional Bayes Factor Stochastic Search for Regression
> ### Models
> ### Aliases: FBF_RS
> ### Keywords: multivariate models dag stochastic search
>
> ### ** Examples
>
>
> data(SimDag6)
>
> Corr=dataSim6$SimCorr[[1]]
> nobs=50
> q=ncol(Corr)
> Gt=dataSim6$TDag
>
> # Regression of Y(q) on Y(q-1),...,Y(1)
>
> Res_search=FBF_RS(Corr, nobs, matrix(0,1,(q-1)), 1, 0.01, 1000, 10)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
warning: sympd() is deprecated and will be removed; change inv(sympd(X)) to inv_sympd(X)
> M_q=Res_search$M_q
> M_G=Res_search$M_G
> M_P=Res_search$M_P
>
>
> Mt=rev(matrix(Gt[1:(q-1),q],1,(q-1))) #True Model
>
> M_med=M_q
> M_med[M_q>=0.5]=1
> M_med[M_q<0.5]=0 #median probability model
>
> sum(sum(abs(M_med-Mt))) #Structural Hamming Distance between the true DAG and the median probability DAG
[1] 0
>
>
>
>
>
>
> dev.off()
null device
1
>