Displaying 20 results from an estimated 100 matches similar to: "uniroot"
2007 Jan 16
0
nlme : convergence problem and other errors
Dear R-user,
I am trying to use the R "nlme" function to fit a non linear mixed
effects model. The model I wand to fit is an individual somatic growth
model with 4 parameters. For all parameters both fixed and random
effects have to be estimated, as well as their covariance matrix (see
the formula bellow).
The data are simulated with the same growth model as in the nlme, with
know
2006 Sep 21
0
TimeZone in ls -lna listings
Hi,
I have a strange situation where when I get different timestamps depending
on if a use ls -l or ls -ln:
---------------
sftp> ls -l
-rw-rw-rw- 1 0 0 39649 Sep 20 11:30
C20060920.1115-20060920.1130
sftp> ls -ln
-rw------- 0 0 0 39649 Sep 20 13:30
C20060920.1115-20060920.1130
--------------
The machine is in timezone UTC+2. According to the
2011 Mar 08
4
If Statement
Hi,
I am having some problems using the if statement correctly. I have used it
many times previously so I dona't know what is different with this case.
Here is my problem:
I have a 1X10 matrix of values as follows:
> H.MC
[,1]
[1,] 4.257669
[2,] 7.023242
[3,] 4.949857
[4,] 5.107000
[5,] 4.257669
[6,] 4.257669
[7,] 4.257669
[8,] 4.257669
[9,] 4.257669
[10,] 4.257669
2005 Jun 30
0
vecortizing uniroot() for numerical solutions
# Hi All,
#
# I need to solve a somewhat complex equation at many parameter
values for
# a number of different parameters.
# A simplified version of the equation is: 0= (d1/(h1^2))-(h2*(d2^2))
# I'd like to solve it across a parameter space of d1 and d2, holding
# h1 and h2 constant.
# It seems that uniroot() can do it, but I don't see how to
vectorize it.
#
2011 Apr 27
1
applying uniroot function to each element in vector
If I have a vector of n elements, e.g. a vector of length 4 with elements 10,
20, 30, 40 and want to find the different values of x such that x^2=10,
x^2=20, x^30 and x^2=40, how could I do this in R? I'm thinking of using the
uniroot function, but am finding difficult applying it to a vector. Thanks
--
View this message in context:
2006 Jul 30
0
re 11. uniroot and function opposite signs warning
Nurza,
Try running a while loop steping out until you have a start and finish
thats the function is opposite in sign. You need a "start" and "finish"
where F is + and - on either side of the loop. Graphing F might help.
step<-10
checkme<-F(start)*F(finish+step)
while(checkme>0){
initialstep<-initialstep*2
checkme<-F(start)*F(finish+step)
}
2000 Feb 24
1
fisher.test() in ctest or perhaps uniroot() (PR#455)
fisher.test(matrix(c(1,20,246,6873),2),hybrid=F)
Error in if (f(lower, ...) * f(upper, ...) >= 0) stop("f() values at end
points not of opposite sign") :
missing value where logical needed
Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list --
2006 Apr 05
0
uniroot warning (lack of) (PR#8750)
Full_Name: Chris Andrews
Version: 2.2.1
OS: Windows
Submission from: (NULL) (128.205.94.95)
The function page for uniroot indicates
If the algorithm does not converge in 'maxiter' steps, a warning
is printed and the current approximation is returned.
I have not been able to get a warning message even when I think I should get one
(see code below).
Perhaps the bug is in the
2006 Oct 27
1
making uniroot a bit more robust?
Hi,
I wonder if it would make sense to make uniroot detect zeros at the
endpoints, eg
if f(lower)==0, return lower as the root, else
if f(upper)==0, return upper as the root, else
stop if f(upper)*f(lower) > 0 (currently it stops if >=), else
proceed to the algorithm proper.
Currently I am using a wrapper function to implement this, and I found
it useful. But I didn't want to send a
2008 Dec 31
1
uniroot() problem
I have a strange problem with uniroot() function. Here is the result :
> uniroot(th, c(-20, 20))
$root
[1] 4.216521e-05
$f.root
[1] 16.66423
$iter
[1] 27
$estim.prec
[1] 6.103516e-05
Pls forgive for not reproducing whole code, here my question is how "f.root"
can be 16.66423? As it is finding root of a function, it must be near Zero.
Am I missing something?
--
View this message
2011 Apr 02
1
uniroot speed and vectorization?
curiosity---given that vector operations are so much faster than
scalar operations, would it make sense to make uniroot vectorized? if
I read the uniroot docs correctly, uniroot() calls an external C
routine which seems to be a scalar function. that must be slow. I am
thinking a vectorized version would be useful for an example such as
of <- function(x,a) ( log(x)+x+a )
uniroot( of, c(
2011 May 27
0
stinterp/spline - uniroot problem
Dear all,
I would like to fit growth data to a smooth curve (preferably using a
Stineman interpolation).
Then I would like to find the intersection of the curve with a horizontal
line (e.g. 0). See below for a coding example.
The root finding using 'uniroot' works fine if I fit the data with
'smooth.spline', but not if I fit the data with 'stinterp' (stinepack) or
2012 Mar 24
1
Solving the equation using uniroot
Hello all,
I was going to solve (n-m)! * (n-k)! = 0.5 *n! * (n-m-k)!
for m when values of n and k are provided
n1<-c(10,13,18,30,60,100,500) # values of n
kx<-seq(1,7,1); # values of k
slv2<-lapply(n1,function(n){
slv1<-lapply(kx,function(k){
lhs<-function(m)
{
2012 Nov 01
1
What does uniroot return when an error occurs
Hi,
I'm using the uniroot function, and would like to detect an error which
occurs, for instance, when the values at endpoints are not of opposite
signs. For example:
uniroot( function(x) x^2+1, lower=1, upper=2 ).
I want to say something like:
if "error in uniroot(...)" return NA else return uniroot$root
Thanks a lot!
Asaf
--
View this message in context:
2023 Feb 18
0
uniroot violates bounds?
c1 <- 4469.822
c2 <- 572.3413
f <- function(x) { c1/x - c2/(1-x) }; uniroot(f, c(1e-6, 1))
uniroot(f, c(1e-6, 1))
provides a root at -6.00e-05, which is outside of the specified
bounds. The default value of the "extendInt" argument to uniroot() is
"no", as far as I can see ...
$root
[1] -6.003516e-05
$f.root
[1] -74453981
$iter
[1] 1
$init.it
[1] NA
2012 Apr 07
1
Uniroot error
Dear All
I am trying to find a uniroot of a function within another function (see
example) but I am getting an error message (f()values at end points not of
opposite sign). I was wondering if you would be able to advise how redefine
my function so that I can find the solution. In short my first function
calculates the intergrale which is function of "t" , I need to find the
uniroot of
2011 May 06
1
Uniroot - error
Hi,
I have tried to use uniroot to solve a value (value a in my function) that
gives f=0, and I repeat this process for 10000 times(stimulations). However
error occures from the 4625th stimulation - Error in uniroot(f, c(0, 2),
maxiter = 1000, tol = 0.001) :
f() values at end points not of opposite sign
I have also tried interval of (lower=min(U), upper=max(U)) and it won't work
as well.
2009 Jun 03
2
problem with uniroot
Hi R-users,I'm trying to solve a non linear equation, to find the degrees of
freedom of a mixture of t student. I'm sure i wrote the minimization
equation in the right way, but when i try to run the EM algorithm to
estimate the parameters of the mixture, the following error will appear:
Error in uniroot(function(z) log(z/2) - digamma(z/2) + 1 - log((z + d)/2) +
:
f() values at end
2011 Apr 03
1
How do I modify uniroot function to return .0001 if error ?
I am calling the uniroot function from inside another function using these
lines (last two lines of the function) :
d <- uniroot(k, c(.001, 250), tol=.05)
return(d$root)
The problem is that on occasion there's a problem with the values I'm
passing to uniroot. In those instances uniroot stops and sends a message
that it can't calculate the root because f.upper * f.lower is greater
2009 Jun 09
1
Problem : solving a equation with R , fail with uniroot function
Hi ,
I would like to know if a R function have the same behaviour than the matlab
solve function.
I tried something with uniroot but I have some problems:
The equation I need to solve is :
exp(c0-r0)*(bb0+x)*(bb1-x)=(bb0+x+1)(bb1-x-1)
So I tried this:
STEP 1: my function test
test <- function(x,bb0=-3,bb1=5,c0=2,r0=0) {
+ ((exp(c0-r0)*(bb0+x)*(bb1-x))/((bb0+x+1)(bb1-x-1))-1)}
STEP 2:
>