# Re: [R] solving non-linear system of equations

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Tue 15 Aug 2006 - 03:01:24 EST

Are you saying you did not receive my reply stamped "8/10/2006 2:12 AM" in my Sent folder, or that my reply was not useful? In case the former is correct, my comments were as follows:

"Have you tried writing a function to compute SS = sum of squares deviations between the the left and right hand sides of your three equations, then using 'optim'? See also Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. (Springer).

p.s. I don't see how it's obvious that 'a=-c'."

If you think these comments are not useful, I would appreciate the courtesy of a reply. I have solved many superficially similar problems in this way, and I would like to know why this would not work for your case.

```       hope this helps.
Spencer Graves

```

HAKAN DEMIRTAS wrote:
> Didn't get any useful response to the following question. Trying again.
> --------------------------------------------------------------------------------
> I can't seem to get computationally stable estimates for the following
> system:
>
> Y=a+bX+cX^2+dX^3, where X~N(0,1). (Y is expressed as a linear combination
> of the first three powers of a standard normal variable.) Assuming that
> E(Y)=0 and Var(Y)=1, one can obtain the following equations after tedious
> algebraic calculations:

>
> 1) b^2+6bd+2c^2+15d^2=1
> 2) 2c(b^2+24bd+105d^2+2)=E(Y^3)
> 3) 24[bd+c^2(1+b^2+28bd)+d^2(12+48bd+141c^2+225d^2)]=E(Y^4)-3
>
> Obviously, a=-c. Suppose that distributional form of Y is given so we know
> E(Y^3) and E(Y^4). In other words, we have access to the third and fourth
> raw moments. How do we solve for these four coefficients? I reduced the
> number of unknowns/equations to two, and subsequently used a grid
> approach. It works well when I am close to the center of the support, but
> fails at the tails. Any ideas?
>
> Hakan Demirtas
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help