Calculating sensitivity indices of R0

I am currently working on a class project where I am supposed to analyze some results in few select papers. I want to calculate the sensitivity indices of the parameters with respect to the basic reproduction number (R0) using the formula S(p)=(p/R0)*(∂R0/∂p) where p is a parameter and S(p) is the sensitivity index of p. I have already calculated the indices manually, but I am interested in learning how to automate the process using Wolfram. The formula for R0 and the parameter values are given below.

betas = 0.274,
alphaa = 0.4775,
alphau = 0.695,
mu = 0.062,
qi = 0.078,
gammaa = 0.29,
1/etai = 0.009,
1/etau = 0.05

R0 = (betas*alphaa)/(gammaa+mu) + (betas*alphau*gammaa*(1-qi))/((gammaa+mu)*(etau+mu))

The answers given in the paper are (βs, μ, γa, αa, ηu, αu, qi) = (1.000, − 0.6060, −0.18464, 0.22348, −0.34666, 0.77652, −0.06474). In fact, I am beginner to Wolfram. So, a comprehensive answer would be highly appreciated. Thanks a lot in advance!

Source: pubmed.ncbi.nlm.nih.gov

Hi Mad,

The underscore character _ represents Blank, so it cannot be used in a symbol name. Try using valid symbol names.

Hi Rohit, I just removed the underscores. Thanks for that!

Quite a few more syntax errors in your code: separate operations are separated by semi-colons, not commas. And you can’t do something like 1/etau = 0.05: you need etau = 1/0.05.

Here is a better way to do what you posted:

Clear["Global`*"]

parameters = {betas -> 0.274, mu -> 0.062, gammaa -> 0.29, 
   alphaa -> 0.4775, etau -> 1/0.05, alphau -> 0.695, qi -> 0.078, 
   etai -> 1/0.009};

baseR0 = (betas*alphaa)/(gammaa + mu) + (betas*alphau*
      gammaa*(1 - qi))/((gammaa + mu)*(etau + mu)) /. parameters

Now, assuming everything is correct, this does what you describe:

In[119]:= Table[
 oldParameter = parameters[[parameter, 2]];
 newParameter = oldParameter*1.001;
 deltaParameter = newParameter - oldParameter;
 newR0 = (betas*alphaa)/(gammaa + mu) + (betas*alphau*
       gammaa*(1 - qi))/((gammaa + mu)*(etau + mu)) /. 
   ReplacePart[parameters, {parameter, 2} -> newParameter];
 deltaR0 = newR0 - baseR0;
 {parameters[[parameter, 
    1]], (oldParameter/baseR0)*(deltaR0/deltaParameter)}, {parameter, 
  1, Length[parameters] - 1}]

Out[119]= {{betas, 1.}, {mu, -0.176164}, {gammaa, -0.804172}, {alphaa,
   0.980971}, {etau, -0.0189516}, {alphau, 
  0.0190293}, {qi, -0.00160985}}

As you see though, it doesn’t give the same values you posted. So it’s possible there is something wrong with either your formula for R0 value, or for the sensitivity.

Hi Gareth, thanks a lot for taking the time to answer my question. It was so helpful and I really appreciate your support. Could you please help me understand the line “newParameter = oldParameter*1.001” in your code?

It’s just a way to create a small (0.001) change in each parameter value.

Hey, on a hunch I changed the parameters to etai = 0.009 and etau = 0.05 (instead of 1/those values), and then I get the same sensitivity values that you posted. So if that is right, the definitions of the parameters in the original post are incorrect. (Because if 1/etau = 0.05, then etau = 1/0.05).

Hey, thanks a lot for the clarification. I see what you mean. I do sincerely appreciate your kind gesture.

I have also been struggling with replicating this graph from the same paper. Any support would be highly appreciated. The authors plot R0 against gamma_a and beta_s.

betas = 0.274,
alphaa = 0.4775,
alphau = 0.695,
mu = 0.062,
qi = 0.078,
gammaa = 0.29,
etai = 0.009,
etau = 0.05

R0 = (betas*alphaa)/(gammaa+mu) + (betas*alphau*gammaa*(1-qi))/((gammaa+mu)*(etau+mu))

Source: pubmed.ncbi.nlm.nih.gov