How to estimate $\alpha$ in $y=(1-\exp(-\alpha x))/(1+\exp(-\alpha x))$?

209 Views Asked by At

I have a function

$$y=\dfrac{1-\exp(-\alpha x)}{1+\exp(-\alpha x)}$$

where $y$ is not binary. The range of this function is $[-1,1)$.

So this does not fit into either logit or probit models. How do I estimate $\alpha$ in such models using some standard package in R?

4

There are 4 best solutions below

2
On

Define $z=\exp (-\alpha x)$, then $y=\frac {1-z}{1+z}$ You can solve this for $z$ by the usual algebra, then take the log and divide by $-x$ to get $\alpha$

0
On

Non-linear least squares. Look into the nls function. https://stat.ethz.ch/R-manual/R-devel/library/stats/html/nls.html.

So, something like:

nls(y ~ (1-exp(-p1*x))/(1+exp(-p1*x)) , start=list(p1=p1_start)...)

0
On

Hoping I properly understand the problem, you have $n$ data points $(x_i,y_i)$ for which you want to adjust the model $$y=\dfrac{1-e^{-\alpha x}}{1+e^{-\alpha x}}$$

As already said, this is relevant from nonlinear regression and, as usual, the problem is to obtain a good starting point. So, in a first step, extract $e^{-\alpha x}$ from the expression; this gives $$e^{-\alpha x}=\frac{1-y}{1+y}$$ that is to say $$\alpha x=\log\Big(\frac{1+y}{1-y}\Big)=z$$ So, for each data point $(x_i,y_i)$ create the corresponding $z_i$ and you will have (standard linear regression through the origin) $$\alpha=\frac{\sum_{i=1}^n x_iz_i}{\sum_{i=1}^n x_i^2}$$ This is just an estimate of the parameter. Now, use the nonlinear regression since you want to minimize the sum of squares related to the $y$'s (the measured values) and not to the the $z$'s (result of a transform).

Any package would be able to do it (even Excel solver).

Edit

You could also notice that $$y=-\tanh \left(\frac{a x}{2}\right)$$ which makes $$ax=-2 \tanh ^{-1}(y)=z$$

Example for illustration purposes

I generated $10$ data points ($i=1,2,\cdots,10$) using $\alpha=0.789$, $x_i=\frac i2$, $$y_i=\dfrac{1-e^{-\alpha x_i}}{1+e^{-\alpha x_i}}+ (-1)^i\times 0.03$$ and I applied the method. This leads to an estimate $\alpha\approx 0.865414$ (which is not too bad) and I started the nonlinear regression. After a couple of iterations, the optimum value for ordinary least square is $0.789285$.

0
On

A non-standard approach:

Take all points in turn and estimate $\alpha=-\frac{2\tanh^{-1}(y)}x$. Then take the median $\alpha$.

In case of outliers, you can even try all $\alpha$ and choose the one that minimizes some error criterion such as the Sum of Absolute Differences. (Unfortunately, this is an $O(n^2)$ procedure.)