You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
predict_MRFnetworks.R has inconsistencies in handling indirect coefficients with bootstrapped MRF models, resulting in indirect coefficients omitted from the predicted networks when a bootstrapped model is used.
For example, within code chunk 119-133, line 126 checks if the length of MRF_mod$indirect_coefs is greater than 0
# Create an MRF_mod object to feed to the predict function
MRF_mod_booted <- list()
MRF_mod_booted$graph <- MRF_mod$direct_coef_means[ , 2:(n_nodes + 1)]
MRF_mod_booted$intercepts <- as.vector(MRF_mod$direct_coef_means[ , 1])
MRF_mod_booted$direct_coefs <- MRF_mod$direct_coef_means
MRF_mod_booted$mod_family <- MRF_mod$mod_family
MRF_mod_booted$mod_type <- 'MRFcov'
if(length(MRF_mod$indirect_coefs) > 0){
for(i in seq_along(MRF_mod$indirect_coef_mean)){
MRF_mod_booted$indirect_coefs[[i]] <- list(MRF_mod$indirect_coef_mean[[i]],"")[1]
}
names(MRF_mod_booted$indirect_coefs) <- names(MRF_mod$indirect_coef_mean)
} else {
MRF_mod_booted$indirect_coefs <- NULL
}
However, MRF_mod$indirect_coefs does not exist for booted models, so length will always = 0. It should be MRF_mod$indirect_coef_mean. This means that MRF_mod_booted$indirect_coefs is never created, causing downstream problems (i.e. predicted networks will not change with the environment)
The same issue occurs again on line 189
# If covariates exist, incorporate their modifications to species' interactions
if(length(MRF_mod$indirect_coefs) > 0){
Checking MRF_mod$indirect_coefs for booted models will always result in FALSE.
The text was updated successfully, but these errors were encountered:
lawwt
added a commit
to lawwt/MRFcov
that referenced
this issue
Nov 30, 2021
predict_MRFnetworks.R has inconsistencies in handling indirect coefficients with bootstrapped MRF models, resulting in indirect coefficients omitted from the predicted networks when a bootstrapped model is used.
For example, within code chunk 119-133, line 126 checks if the length of MRF_mod$indirect_coefs is greater than 0
However, MRF_mod$indirect_coefs does not exist for booted models, so length will always = 0. It should be MRF_mod$indirect_coef_mean. This means that MRF_mod_booted$indirect_coefs is never created, causing downstream problems (i.e. predicted networks will not change with the environment)
The same issue occurs again on line 189
Checking MRF_mod$indirect_coefs for booted models will always result in FALSE.
The text was updated successfully, but these errors were encountered: