I'm trying to adapt some Dynamic Bayesian Network code to work with my own (made up) data. I'm working in R using the dbnR package. Attached screenshot of full code up to error. All working up to the inference step, where I get an error message. What I should be seeing is a cute little line graph predicting the behavior of the objective variable over time.

My advisor suggested the folded data and/or sigma matrix not being square might be the problem, but the dimensions in the fully functional example code are not square either. I've tried adjusting data values, and changing 0,1 binary to Y,N, and back again with no result. I really appreciate any advice. Error Message and Code

Exact message:

> obj_var<-c("AnxScl_t_0")
> res3<- (predict_dt(fit3,f_dt_val3,obj_var,verbose=T))  # STILL BROKEN HERE
Error in solve.default(sigma[ev_pos, ev_pos]) : 
  Lapack routine dgesv: system is exactly singular: U[1,1] = 0
In addition: Warning message:
In value[[3L]](cond) :
  The sigma matrix is computationally singular. Using the pseudo-inverse instead.

A reproducible example:

DF3 <- structure(list(DepScl = c(8, 6, 7, 8, 9, 5, 7, 5, 6, 8), 
                      AnxScl = c(9, 9, 10, 7, 8, 7, 8, 6, 4, 4), 
                      DMed = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
                      AMed = c(0, 0, 0, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15),
                      SubUse = c(1, 1, 1, 1, 0, 1, 0, 0, 0, 0), 
                      Hallucin = c(0, 1, 1, 1, 0, 0, 1, 0, 0, 0), 
                      SuicIdea = c(1, 0, 0, 0, 1, 0, 0, 0, 0, 1), 
                      Dissoc = c(1, 1, 0, 1, 1, 1, 1, 1, 0, 1), 
                      Work = c(0, 0, 1, 1, 1, 1, 1, 1, 1, 1), 
                      Hospit = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), 
                 row.names = c(NA, 10L), class = "data.frame")

library(dbnR)
size <- 2
net3 <- learn_dbn_struc(DF3, size)
f_dt_val3 <- fold_dt(DF3, size)
fit3 <- fit_dbn_params(net3, f_dt_val3, method="mle")
obj_var <- "AnxScl_t_0"
res3 <- predict_dt(fit3, f_dt_val3, obj_var, verbose=TRUE)

Error in solve.default(sigma[ev_pos, ev_pos]) :
Lapack routine dgesv: system is exactly singular: U[2,2] = 0
In addition: Warning message:
In value[3L] :
The sigma matrix is computationally singular. Using the pseudo-inverse instead.

0

There are 0 answers