I would like Mathematica to solve for each of a, b, c, d in terms of Sensitivity, Specificity, PPV and NPV.
I don’t know how to do that. Can anyone help?
Solve[{sens == sensitivity[a, c], spec == specificity[b, d],
ppv == pPV[a, b], npv == nPV[c, d]}, {a, b, c, d},
MaxExtraConditions -> 1]
(*
During evaluation of In[932]:= Solve::svars: Equations may not give solutions for all "solve" variables.
Out[932]= {{b ->
ConditionalExpression[(100 a - a ppv)/ppv,
100 npv ppv - npv ppv sens - npv ppv spec - 100 sens spec +
npv sens spec + ppv sens spec == 0],
c -> ConditionalExpression[(100 a - a sens)/sens,
100 npv ppv - npv ppv sens - npv ppv spec - 100 sens spec +
npv sens spec + ppv sens spec == 0],
d -> ConditionalExpression[(
a npv (-100 + sens))/((-100 + npv) sens),
100 npv ppv - npv ppv sens - npv ppv spec - 100 sens spec +
npv sens spec + ppv sens spec == 0]}} *)
There seems to be a needed compatibility condition to make the system consistent. And also a missing equation because as posed the system is homogeneous in {a,b,c,d}, which means a normalization is needed or else we get (as we do) a common parametrized factor (a, in this case) in the solutions.