options("digits"=3)
data(math, package="gRbase")
S <- cov(math)
nobs <- nrow(math)
gl <- list(1:3, 3:5)
em <- matrix(c(1,2, 2,3, 1,3, 3,4, 3,5, 4,5), nrow=2)
EPS = 1e-2
fit_cov = fit_ggm_grips(S, gl, nobs=nobs, eps=EPS, method="cov")
fit_con = fit_ggm_grips(S, gl, nobs=nobs, eps=EPS, method="con")
fit_ncd = fit_ggm_grips(S, gl, nobs=nobs, eps=EPS, method="ncd")
K <- solve(S)
(fit_con$K - K) |> abs() |> max()
(fit_cov$K - K) |> abs() |> max()
(fit_ncd$K - K) |> abs() |> max()
Run the code above in your browser using DataLab