Fairly complicated partial derivative I have a stats assignment, that requires the use of non linear regression - this I am fine with in principle, however I can't get the initial $X$ matrix, because I don't understand partial derivatives. All the examples I have found are either very simple, or don't explain why things are the way they are, or both.
So, this is the equation:
$$y_i = \frac{r_1^*x_i^2+x_i(1-x_i)}{r_1^*x_i^2+2x_i(1-x_i) + r_2^*(1-x_i)^2}+\mathcal{E}_i$$
I need to know the derivative with relation to $r_1^*$ and $r_2^*$. I would love to know both the equation of how to get it (with an explanation) as well as the actual values where:
$r_1^* = 0.4$
$r_2^* = 0.6$
for each of these four $x_i$'s:
0.2145
0.6074
0.7831
0.8976

Like I said above, an explanation, the equation and the answers would be great, as I am totally stumped!
Thanks!
 A: Hint:  The derivative of $x^3$ is $3x^2$, not $3x$.  If you know the quotient and product rules it is mechanical.  I don't have much intuition about this, either.  For the partial with respect to $r_1^*$ you just need to remember that everything else is a constant.  So the partial of the numerator with respect to $r_2^*$ is zero-it is a constant.
Added:  because the quotient rule says $\frac {\partial \frac {f(x)}{g(x)}}{\partial x}=\frac {g(x)\frac{\partial {f(x)}}{\partial x}-f(x)\frac{\partial {g(x)}}{\partial x}}{(g(x))^2}$ we have
$\frac {\partial y_i}{\partial r_2^*} = \frac{-(r_1^*x_i^2+x_i(1-x_i))(1-x_i)^2}{(r_1^*x_i^2+2x_i(1-x_i) + r_2^*(1-x_i)^2)^2}$
A: If you want just fit a nonlinear curve, use a package. 
Download the R statistical program in www.r-project.org/cran. It is free!
Then define the response variable
y<-c(y1,y2,y3,...,yn)
define the explanatory variable
x<-c(x1,x2,x3,...,xn)
Nonlinear functions are fitted with
mod<-nls(y~formula,start=c(r1=1.0,r2=5))
in formula you must specify the model, example: r1*exp(x*r2)
start is the vector with initial guesses for the parameter values: you must to choice appropriate values
In order to see the estimated coefficients, make
summary(mod)
