sensitivity[a_, c_] := (a/(a + c))*100
specificity[b_, d_] := (d/(b + d))*100
pPV[a_, b_] := (a/(a + b))*100
nPV[c_, d_] := (d/(c + d))*100
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.