Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 71df56a
Author: aterui <[email protected]>
Date:   Thu Mar 24 17:48:36 2022 -0400

    edit: fun_igp

    correction to igprey igpred functions
  • Loading branch information
aterui committed Mar 24, 2022
1 parent ca4ad26 commit e7a511e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
13 changes: 2 additions & 11 deletions R/fun_igp.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@ fun_igp <- function(x,

# intraguild prey v_n_c ####
## survived = basal survival x predation-induced mortality
v_n_c_bar <- s0_c * (1 - v_z_cp) * v_n_c
v_n_c_hat <- e_bc * (v_z_bc * v_n_b)
v_n_c_hat <- e_bc * (s0_c * (1 - v_z_cp) * (v_z_bc * v_n_b))

# intraguild predator v_n_p ####
v_n_p_bar <- s0_p * v_n_p
v_n_p_hat <- v_delta * e_bp * (v_z_bp * v_n_b) + (1 - v_delta) * e_cp * v_w_cp
v_n_p_hat <- s0_p * (v_delta * e_bp * (v_z_bp * v_n_b) + (1 - v_delta) * e_cp * v_w_cp)
v_n_p_hat[is.nan(v_n_p_hat)] <- 0


Expand All @@ -132,12 +130,6 @@ fun_igp <- function(x,

dimnames(m_z) <- NULL

m_n_bar <- rbind(v_n_b_bar,
v_n_c_bar,
v_n_p_bar)

dimnames(m_n_bar) <- NULL

m_n_hat <- rbind(v_n_b_hat,
v_n_c_hat,
v_n_p_hat)
Expand All @@ -146,7 +138,6 @@ fun_igp <- function(x,

return(list(delta = v_delta,
z = m_z,
m_n_bar = m_n_bar,
m_n_hat = m_n_hat)
)

Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-fun_igp.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ z_ref[2:3, ] <- 0.25
test_that("N-zero matrix", {
expect_equal(y_zero$z,
zero_ref)
expect_equal(y_zero$m_n_bar,
zero_ref)
expect_equal(y_zero$m_n_hat,
zero_ref)
})
Expand Down

0 comments on commit e7a511e

Please sign in to comment.