1
$\begingroup$

I have the following equation:

p = 1/(1 + E^(-51.179 + 0.849 x1 + 2.3649 x2 + 1.155 x3 + 1.46 x4 + 1.31 x5))

and I want to find the set of values for x1 to x5 such that the fraction be equal to 0.5.In other words, I want x1-x5 values for which p==0.5. I tried NSolve and Reduce but those didn't work. All x1-x5 are between 0 and 10.

I searched the list but I couldn't come up with a solution. Any help is appreciated.

$\endgroup$

1 Answer 1

2
$\begingroup$
FindInstance[p == 0.5, {x1, x2, x3, x4, x5}]

Gives:

{{x1 -> -3.5 + 4.9 I, x2 -> -0.6 - 1.1 I, x3 -> -3.2 + 0.5 I, 
  x4 -> -0.2 - 2.5 I, x5 -> 45.4637 + 44.3225 I}}

You can also limit the domain and ask to find n instances

   sol = FindInstance[p == 0.5, {x1, x2, x3, x4, x5}, Reals, 3]
{{x1 -> -7.5, x2 -> -3.7, x3 -> -0.5, x4 -> 14.4, x5 -> 35.0001},
 {x1 -> 6.6, x2 -> -11.2, x3 -> -5., x4 -> 5.9,  x5 -> 52.8424}, 
 {x1 -> 11.4, x2 -> 14.9, x3 -> 5.2, x4 -> 11.3, x5 -> -12.3974}}

Check

p /. sol    

{0.5, 0.5, 0.5}

To specifically select values that meet your criteria do the following:

FindInstance[{p == 0.5, x1 > 0 && x1 <= 10, x2 > 0 && x2 <= 10, 
  x3 > 0 && x3 <= 10, x4 > 0 && x4 <= 10, x5 > 0 && x5 <= 10}, {x1, 
  x2, x3, x4, x5}, Reals]

Gives

{{x1 -> 1.06349, x2 -> 4.66239, x3 -> 10., x4 -> 10., x5 -> 10.}}

$\endgroup$
5
  • $\begingroup$ thanks for your respone.Is it possible to find a unique set? I found that equation using LogitModelFit given data on five predictors and an outcome variable. $\endgroup$
    – Amin
    Commented Oct 25, 2013 at 4:46
  • $\begingroup$ @Amin. If I understand Mathematics well, having one equation with more than one unknowns will not give you a unique solution. $\endgroup$
    – RunnyKine
    Commented Oct 25, 2013 at 4:51
  • $\begingroup$ You're right.Indeed, I'm talking in the context of statistics where we try to find best solutions.For instance, those coefficients are obtained based on least squares. I think I should restrict values of x1-x5 in more reasonable limits then I would be able to find some acceptable results. $\endgroup$
    – Amin
    Commented Oct 25, 2013 at 4:55
  • $\begingroup$ @Amin. I can't really help you with that as I am no statistician. But that may be a way to go. But at least my post answered your question right? $\endgroup$
    – RunnyKine
    Commented Oct 25, 2013 at 4:58
  • 1
    $\begingroup$ p == 0.5 when the argument of the exponential is zero -- i.e. $1/(1+\exp(0))=0.5$. So your solution set is the hyperplane -51.179 + 0.849 x1 + 2.3649 x2 + 1.155 x3 + 1.46 x4 + 1.31 x5 == 0. $\endgroup$ Commented Oct 25, 2013 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.