Skip to content

solving equation system

3 messages · Carsten Steinhoff, Spencer Graves, Clark Allan

#
Have you considered writing a function to compute the sum of squares 
of deviations from equality and using "optim"?  I use sum of squares not 
sum of absolute values, because if my functions are differentiable, the 
sum of squares will also be differentible while the sum of absolute 
values will not be.  This means that sum of absolute values will not 
work well with a quasi-Newton algorithm.

	  Also, have you considered making plots?  If I understand your 
example, you can solve for lambda using (II) as lambda = x/mean(X). 
Then you can use (I) to solve for "c".  To understand this, it would 
help to plot the digamma function.  If you do this (e.g., 
http://mathworld.wolfram.com/DigammaFunction.html), you will see that 
there are countably infinite solutions to this equation.  If you want 
the positive solution, I suggest you try to solve for ln.c = log(c) 
rather than "c" directly, because that should make "optim" more stable. 
  More generally, it often helps to make, e.g., contour or perspective 
plots and to try to find a parameterization that will make the sum of 
squares of errors approximatly parabolic in your parameters.

	  My favorite reference on this is Bates and Watts (1988) Nonlinear 
Regression Analysis and Its Applications (Wiley).  There may be better, 
more recent treatments of this subject, but I am not familiar with them.

	  spencer graves
p.s.  I never (no never, not ever) use "c" as a variable name, because 
it is the name of a common R function.  R is smart enough to distinguish 
between a function and a non-function in some contexts but not in all. 
When I want a name for a new object, I routinely ask R to print my 
proposed name.  If it returns "Error:  object ... not found", I can use 
"...".
Carsten Steinhoff wrote:

            

  
    
4 days later
#
HI ALL

i would like to solve a complex set of equations. i have four parameters
and four equations. i could set up more equations since they are derived
from the momnets of a particular distribution.

the parameters are NON LINEAR!!!

AND the eqautions are of the form:

phi(i)=function(a,x,y,z)

is there a package or group of commands that might be used in order to
solve the system directly?

thanking you in advance

/
allan
Spencer Graves wrote: