0
|
801 Views
|
|
3 Total Likes
View groups...
Share
GROUPS:

# Solve four simultaneous equations?

Posted 5 months ago
 I have four equations in four unknowns, a,b,c,d: 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  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?
Sort By:
Posted 5 months ago
 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.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.