construct Jacobian matrix for ICU model (not quite complete: doesn't include flows to R)

make_jac(params, state = NULL)

Arguments

params

parameter vector

state

state vector (named)

Examples

params <- read_params("ICU1.csv")
state <- make_state(params[["N"]],E0=params[["E0"]], use_eigvec=FALSE)
## state[c("E","Ia","Ip","Im","Is")] <- 1
state[["E"]] <- 1
J <- make_jac(params,state)
J["S","S"]
#> [1] 0
Jr <- J[1:6,1:6]
round(Jr,3)
#>     to
#> from S      E     Ia     Ip     Im     Is
#>   S  0  0.000 -0.667 -1.000 -1.000 -1.000
#>   E  0 -0.192  0.667  1.000  1.000  1.000
#>   Ia 0  0.064 -0.143  0.000  0.000  0.000
#>   Ip 0  0.128  0.000 -2.000  0.000  0.000
#>   Im 0  0.000  0.000  1.912 -0.143  0.000
#>   Is 0  0.000  0.000  0.088  0.000 -0.175
eigen(Jr)$values
#> [1] -1.9941503 -0.5979562  0.2558539 -0.1737373 -0.1428571  0.0000000
make_jac(params)
#>       to
#> from   S           E         Ia     Ip         Im          Is    H   H2  ICUs
#>   S    0  0.00000000 -0.6666667 -1.000 -1.0000000 -1.00000000  0.0  0.0  0.00
#>   E    0 -0.19230769  0.6666667  1.000  1.0000000  1.00000000  0.0  0.0  0.00
#>   Ia   0  0.06410256 -0.1428571  0.000  0.0000000  0.00000000  0.0  0.0  0.00
#>   Ip   0  0.12820513  0.0000000 -2.000  0.0000000  0.00000000  0.0  0.0  0.00
#>   Im   0  0.00000000  0.0000000  1.912 -0.1428571  0.00000000  0.0  0.0  0.00
#>   Is   0  0.00000000  0.0000000  0.088  0.0000000 -0.17482517  0.0  0.0  0.00
#>   H    0  0.00000000  0.0000000  0.000  0.0000000  0.13286713 -0.1  0.0  0.00
#>   H2   0  0.00000000  0.0000000  0.000  0.0000000  0.00000000  0.0 -0.2  0.05
#>   ICUs 0  0.00000000  0.0000000  0.000  0.0000000  0.02097902  0.0  0.0 -0.05
#>   ICUd 0  0.00000000  0.0000000  0.000  0.0000000  0.02097902  0.0  0.0  0.00
#>   D    0  0.00000000  0.0000000  0.000  0.0000000  0.00000000  0.0  0.0  0.00
#>   R    0  0.00000000  0.1428571  0.000  0.1428571  0.00000000  0.1  0.2  0.00
#>   X    0  0.00000000  0.0000000  0.000  0.0000000  0.00000000  0.0  0.0  0.00
#>   V    0  0.00000000  0.0000000  0.000  0.0000000  0.00000000  0.0  0.0  0.00
#>       to
#> from     ICUd D R X V
#>   S     0.000 0 0 0 0
#>   E     0.000 0 0 0 0
#>   Ia    0.000 0 0 0 0
#>   Ip    0.000 0 0 0 0
#>   Im    0.000 0 0 0 0
#>   Is    0.000 0 0 0 0
#>   H     0.000 0 0 0 0
#>   H2    0.000 0 0 0 0
#>   ICUs  0.000 0 0 0 0
#>   ICUd -0.125 0 0 0 0
#>   D     0.125 0 0 0 0
#>   R     0.000 0 0 0 0
#>   X     0.000 0 0 0 0
#>   V     0.000 0 0 0 0