# Using approximation to find a value of theta

So I have one vector of alpha, one vector of beta, and I am trying to find a theta for when the sum of all the estimates (for alpha's i to n and beta's i to n) equals 60.

Basically what I did is start from theta = 0.0001, and iterate through, calculating all these sums, and when it is lower than 60, continue by adding 0.0001 each time, while above 60 means we found the theta.

I found the value theta this way. Problem is, it took me about 60 seconds using Python, to find a theta of 0.456.

What is quicker approach to find this theta (since I would like to apply this for other data)?

-
It is very hard to understand what you're asking. Please explain what you're trying to achieve, using standard notation and terminology. – yohBS Mar 18 '13 at 15:21
@yohBS Does this help? – Dualinity Mar 18 '13 at 15:54

## 2 Answers

Define

$$f(\theta)=\sum_{i=1}^{N}\frac{e^{\alpha_i(\theta-\beta_i)}}{1+e^{\alpha_i(\theta-\beta_i)}}-60$$

You want to find a $\theta$ for which $f(\theta)=0$. This is a common task, and is called root finding. There are numerous ways to achieve that, and python (scipy) has a built in function that does that - fsolve.

-

I used the bisectional method for finding the root.

-