[R] Iterative Solver [Converting Matlab's solve()]

Boris Igic bigic at ucsd.edu
Tue Jun 19 06:24:19 CEST 2007


I can't for the life of me figure out how to get the roots for this simple
(but sovable only iteratively) equation in R:

x = z*(1-(1-2/z)^y

where x and y are known, and z is unknown. In Matlab, this amounts to:

[my.solution] = solve('x = z*(1-(1-2/z)^y') 
my.solution.real = solution(y-1,y)

% bottom line displays non-imaginary solution (last element)

Obviously, I'm deeply unqualified as a mathematician or programmer and 
regret wasting your time if this question is really basic. I would very 
much appreciate even the smallest morsel of time that you might spend on 
this, and yes, you could be my hero.

Many Thanks,

Boris

P.S. The above equation is from: Paxman GJ (1963). Maximum likelihood 
estimation of the number of self-sterility alleles in a population. 
Genetics 48: 1029-1032.



More information about the R-help mailing list