Instead of returning an error when estimate.parameters encounters a singular Gram matrix, return valid estimates for those nodes that are nonsingular (< n parents). Output a warning, and return NA for nodes with > n parents.
Also, improve the error message, which is a bit cryptic:
Error in fit_glm_dag(edges, data$data, call = "lm.fit", ...) :
Node 465 has too many parents! <27 > 22>
Instead of returning an error when
estimate.parameters
encounters a singular Gram matrix, return valid estimates for those nodes that are nonsingular (< n parents). Output a warning, and returnNA
for nodes with > n parents.Also, improve the error message, which is a bit cryptic: