[R] solving equation system
Clark Allan
Allan at STATS.uct.ac.za
Tue Jun 28 12:43:44 CEST 2005
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:
>
> 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:
>
> > Hello,
> >
> > I want to solve some two dimensional equation system with R. Some systems
> > are not solvable analytically.
> >
> > Here is an example:
> >
> > (I) 1/n*sum{from_i=1_to_n}(Xi) = ln lambda + digamma(c)
> >
> > (II) mean(X) = x / lambda
> >
> > I want to find lambda and c,
> >
> > which R-function could do that task?
> >
> > Carsten
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
> --
> Spencer Graves, PhD
> Senior Development Engineer
> PDF Solutions, Inc.
> 333 West San Carlos Street Suite 700
> San Jose, CA 95110, USA
>
> spencer.graves at pdf.com
> www.pdf.com <http://www.pdf.com>
> Tel: 408-938-4420
> Fax: 408-280-7915
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list