Skip to content

Commit

Permalink
issue nicholasjclark#33 fix network bootstrap network prediction
Browse files Browse the repository at this point in the history
Changed check for if boostrapped model has covariates so that it matches the bootstrap object.
  • Loading branch information
lawwt committed Nov 30, 2021
1 parent dba1ec6 commit 5c70f0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/predict_MRFnetworks.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ predict_MRFnetworks = function(data, MRF_mod, cutoff, omit_zeros, metric,
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){
if(length(MRF_mod$indirect_coef_mean) > 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]
}
Expand Down Expand Up @@ -186,7 +186,7 @@ predict_MRFnetworks = function(data, MRF_mod, cutoff, omit_zeros, metric,
base.interactions <- MRF_mod_booted$graph

# If covariates exist, incorporate their modifications to species' interactions
if(length(MRF_mod$indirect_coefs) > 0){
if(length(MRF_mod_booted$indirect_coefs) > 0){
total.interactions <- lapply(seq_len(nrow(data)), function(x){
cov.mods <- list()
for(i in seq_along(MRF_mod_booted$indirect_coefs)){
Expand Down

0 comments on commit 5c70f0a

Please sign in to comment.