Displaying 20 results from an estimated 9000 matches similar to: "Bug in numericDeriv (was: [R] nls confidence intervals) (PR#3746)"
2007 Feb 13
1
nls: "missing value or an infinity" (Error in numericDeriv) and "singular gradient matrix"Error in nlsModel
Hi,
I am a non-expert user of R. I am essaying the fit of two different functions to my data, but I receive two different error messages. I suppose I have two different problems here... But, of which nature? In the first instance I did try with some different starting values for the parameters, but without success.
If anyone could suggest a sensible way to proceed to solve these I would be
2005 Nov 16
2
numericDeriv
I have to compute some standard errors using the delta
method and so have to use the command "numericDeriv"
to get the desired gradient. Befor using it on my
complicated function, I've done a try with a simple
exemple :
x <- 1:5
numericDeriv(quote(x^2),"x")
and i get :
[1] 1 8 27 64 125 216
attr(,"gradient")
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] Inf
2003 Aug 14
2
nls confidence intervals
Hi,
Does anyone know how to compute the confidence prediction intervals for
a nonlinear least squares models (nls)?
I was trying to use the function 'predict' as I usually do for other
models fitting (glm, lm, gams...), but it seems that se.fit, and
interval computation is not implemented for the nls...
Cheers
Enrique
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fisheries Research Services,
Marine
2010 Jan 13
1
Problem fitting a non-linear regression model with nls
Hi,
I'm trying to make a regression of the form :
formula <- y ~ Asym_inf + Asym_sup * ( (1 / (1 + (n1 * (exp( (tmid1-x)
/ scal1) )^(1/n1) ) ) ) - (1 / (1 + (n2 * (exp( (tmid2-x) / scal2)
)^(1/n2) ) ) ) )
which is a sum of the generalized logistic model proposed by richards.
with data such as these:
x <- c(88,113,128,143,157,172,184,198,210,226,240,249,263,284,302,340)
y <-
2012 May 18
1
Help for numericDeriv function
Hi,
I am stuck on something for a couple days, I am almost about to give up.
This looks simple, but I can't figure out. I hope I can get some help here.
I am trying to do some symbolic and numerical derivations. Let me explain
the problem. Let's say, I have a matrix as follows:
> load <- matrix(c(3,0,1,4,1,3),nrow=3,ncol=2,byrow=TRUE)
>
> load
[,1] [,2]
[1,] 3 0
2009 Aug 25
3
Covariates in NLS (Multiple nonlinear regression)
Dear R-users,
I am trying to create a model using the NLS function, such that:
Y = f(X) + q + e
Where f is a nonlinear (Weibull: a*(1-exp(-b*X^c)) function of X and q is a covariate (continous variable) and e is an error term. I know that you can create multiple nonlinear regressions where x is polynomial for example, but is it possible to do this kind of thing when x is a function with unknown
2020 Jun 16
1
[External] numericDeriv alters result of eval in R 4.0.1
Dear all
As far as I could trace, looking at the function C function numeric_deriv,
this unwanted behavior comes from the inner most loop in, at the very end
of the function,
for(i = 0, start = 0; i < LENGTH(theta); i++) {
for(j = 0; j < LENGTH(VECTOR_ELT(pars, i)); j++, start += LENGTH(ans)) {
SEXP ans_del;
double origPar, xx, delta;
origPar = REAL(VECTOR_ELT(pars, i))[j];
2020 Jun 16
0
[External] numericDeriv alters result of eval in R 4.0.1
Thanks; definitely a bug. I've submitted it to the bug tracker at
https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17831
Best,
luke
On Mon, 15 Jun 2020, Raimundo Neto wrote:
> Dear R developers,
>
> I've run into a weird behavior of the numericDeriv function (from the stats
> package) which I also posted on StackOverflow (question has same title as
> this email,
2020 Jun 15
2
numericDeriv alters result of eval in R 4.0.1
Dear R developers,
I've run into a weird behavior of the numericDeriv function (from the stats
package) which I also posted on StackOverflow (question has same title as
this email, except for the version of R).
Running the code bellow we can see that the numericDeriv function gives an
error as the derivative of x^a wrt a is x^a * log(x) and log is not defined
for negative numbers. However,
2003 Apr 28
0
AW: AW: numericDeriv and ecdf
Dear Prof. Brian Ripley,
first of all thank you for your answer, I do appreciate
how do you manage to keep successfully all your
activities and answer posts in this forum!
> An empirical CDF is a step function: it does not have a
> derivative at the jump points, and has a zero
> derivative everywhere else.
of course!
Let me add few words concerning my simple motivation.
1.
2010 Jul 06
0
Help needed with numericDeriv and optim functions
Hello All:
I have defined the following function (fitterma as a sum of exponentials)
that best fits my cumulative distribution. I am also attaching the "xtime"
values that I have. I want to try two things as indicated below and am
experiencing problems. Any help will be greatly appreciated.
Best, Parmee
-----------------------
*fitterma <- function(xtime) { *
*a <-
2004 Oct 07
1
confidence interval for nls
Do I have the right impression that it's currently not possible to
produce confidence intervals for the nls predictions using R?
I had a course were we used SAS PROC nlin and there you could get
intervals for the parameters and the prediction but I do not have access
to SAS.
Would it be difficult to implement, I tried to dig into the help pages
of nls, vcov and nlsModel but I could not
2006 Jan 19
1
numericDeriv() giving a vector when multiple variables input
R Help List --
I have defined two time-series-vector-valued-functions, let them be f and g,
and want to find the numeric derivative of f with respect to the variable x
where f depends on x through g:
(d/dx)(f (g(x) )
Moreover, x is a vector
I tried this out the long way (naming every element of the x vector and then
making the 'theta' argument in numericDeriv() the character vector of
2004 Apr 28
4
numericDeriv
Dear All,
I am trying to solve a Generalized Method of Moments problem which
necessitate the gradient of moments computation to get the
standard errors of estimates.
I know optim does not output the gradient, but I can use numericDeriv to
get that. My question is: is this the best function to do this?
Thank you
Jean,
2003 Apr 25
2
AW: numericDeriv and ecdf
> On only ten points, what did you expect ? Even with 1000
> observations, estimating a density is difficult, and has
> been the subject of a century of research. Kernel density
> estimates are among the most successful. For your immediate
> application, try plot(density(rnorm(10)), type="l"), etc.
wait, you misunderstood me!
I'd like to see 10 or 9 points with
2008 May 23
3
nls diagnostics?
Hi, All:
What tools exist for diagnosing singular gradient problems with
'nls'? Consider the following toy example:
DF1 <- data.frame(y=1:9, one=rep(1,9))
nlsToyProblem <- nls(y~(a+2*b)*one, DF1, start=list(a=1, b=1),
control=nls.control(warnOnly=TRUE))
Error in nlsModel(formula, mf, start, wts) :
singular gradient matrix at initial
2007 Aug 23
0
weighted nls and confidence intervals
for unweighted fits using `nls' I compute confidence intervals for the
fitted model function by using:
#-------------------
se.fit <- sqrt(apply(rr$m$gradient(), 1, function(x) sum(vcov(rr)*outer(x,x))))
luconf <- yfit + outer(se.fit, qnorm(c(probex, 1 - probex)))
#-------------------
where `rr' contains an `nls' object, `x' is the independent variable vector,
`yfit'
2007 Oct 28
0
Request for help with nls error
Hi. I am attempting to run my code to get estimates for a nonlinear
model. Unfortunately, when I run the code, I keep getting the following
errors (they switch back and forth depending on when I run it):
Error in nlsModel(formula, mf, start, wts) :
singular gradient matrix at initial parameter estimates
Error in nls(ywt_vib ~ weightfunc_vib(time_vib, Wmax_star, tau_star,
gamma_star,
2009 Dec 18
2
NLS-Weibull-ERROR
Hello
I was trying to estimate the weibull model using nls after putting OLS
values as the initial inputs to NLS.
I tried multiple times but still i m getting the same error of Error in
nlsModel(formula, mf, start, wts) :
singular gradient matrix at initial parameter estimates.
The Program is as below
> vel <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
> df <- data.frame(conc, vel)
>
2011 Jun 30
1
Error "singular gradient matrix at initial parameter estimates" in nls
Greetings,
I am struggling a bit with a non-linear regression. The problem is
described below with the known values r and D inidcated.
I tried to alter the start values but get always following error
message:
Error in nlsModel(formula, mf, start, wts):
singular gradient matrix at initial parameter estimates
Calls: nls -> switch -> nlsModel
I might be missing something with regard to the