search for: numericderiv

Displaying 20 results from an estimated 94 matches for "numericderiv".

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 0 0...
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 ne...
2012 May 18
1
Help for numericDeriv function
...ot; "l12" [2,] "l21" "l22" [3,] "l31" "l32" > l11 [1] 3 > l12 [1] 0 > l21 [1] 1 > l22 [1] 4 > l31 [1] 1 > l32 [1] 3 Let's say, I need to take the derivative of (l11*l21+l12*l22) with respect to l11,l12,l21,l22,l31,l32. > numericDeriv(quote(l11*l21+l12*l22), c(t(l),recursive=TRUE)) [1] 3 attr(,"gradient") [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 4 3 0 0 0 Everything is fine up to this point. I need what I have. But, I don't want to manipulate the elements in "quote()" manually within t...
2003 Apr 25
2
AW: numericDeriv and ecdf
...he 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 estimated values of *numerical* derivatives according to ecdf output. And that's it. Now look into output of numericDerivative in my example: [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 attr(,"gradient") [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0 0 0 0 0 0 0 0 0 0 [2,] 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0...
2006 Jan 19
1
numericDeriv() giving a vector when multiple variables input
...-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 all these names) and the result is just one time series vector; I was hoping for a matrix. Also weirdly, if I instead make theta equal to just one of the named elements of x, I get the same time series vector; the same happens for any subset of the named elements My call...
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, 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 l...
2020 Jun 16
1
[External] numericDeriv alters result of eval in R 4.0.1
...y 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, except for the version of R). > > > > Running the code bellow we can see that the numericDeriv function gives > an > > error as the derivative...
2003 Apr 25
1
numericDeriv and ecdf
Hi All, following expression: x <- sort(rnorm(10)); e <- ecdf(x); d <- numericDeriv(e(x),"x"); makes d far from approximation of one dimensional pdf. What's wrong then here? Kind regards. --------------------------------------------------------------------------- Valery A.Khamenya Bioinformatics Department BioVisioN AG, Hannover
2003 Apr 28
0
AW: AW: numericDeriv and ecdf
...rm(10000) ) dx <- diff(x) ed <- 1/10000/dx plot(x[-1], ed, log="y") # my "empirical density" lines(x,dnorm(x),col=2) Now I could have estimation for differential entropy like this: -sum(ed*log(ed)*dx) That's it. > What is this function `numericDerivative': do you mean `numericDeriv'? yes. Sorry, there is no auto-completion function in my non-emacs email client as in emacs' ESS environment ;-) kind regards, Valery A.Khamenya --------------------------------------------------------------------------- Bioinformatics Department BioV...
2008 Oct 12
2
numeric derivation
Hello, I don't understand the description / help-text for the numericDeriv() function. Why is there a new environment used? And what is meant with an environment here? Is it similar or the same as a local workspace, like an environment in functional languages? And why is it needed here? numericDeriv could just calculate the difference bewtween two values and divide th...
2010 Jul 06
0
Help needed with numericDeriv and optim functions
...{ * *a <- -0.09144115* *b <- -0.01335756* *c <- -2.368057* *d <- -0.00600052* *return(exp(a+b*xtime)+exp(c+d*xtime))* *}* I want to do two things: *First, take the numerical derivative of this function (fitterma)* to obtain probability density function. I tried using: *> numericDeriv(fitterma,"xtime")* *Error in numericDeriv(fitterma, "xtime") : * * cannot coerce type 'closure' to vector of type 'double'* Looking at the complaint above, I don't understand how to use the above function properly. Any help will be appreciated. *Secon...
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,
2007 Feb 13
1
nls: "missing value or an infinity" (Error in numericDeriv) and "singular gradient matrix"Error in nlsModel
...96 12 12 0.098210497 13 13 0.093786895 14 14 0.033752379 15 15 0.038961039 16 16 0.023048216 17 17 0.010018243 18 18 0.007177034 19 19 0.003787879 20 20 0.000000000 21 21 0.000000000 #Exponential power function > s=nls(fath~((b^2)/(a^2))*exp((-dist/a)^b),polcurve) Error in numericDeriv(form[[3]], names(ind), env) : Missing value or an infinity produced when evaluating the model In addition: Warning message: No starting values specified for some parameters. Intializing 'b', 'a' to '1.'. Consider specifying 'start' or using a selfStart model...
2003 Dec 18
1
NUMERIC DERIVATE
...ist(fnscale=-1),hessian=T); and I want to calculate the derivates, psi1<-valor.optim$par[1] psi2<-valor.optim$par[2] psi3<-valor.optim$par[3] a0=exp(psi1); a1=exp(psi2)/(20+exp(psi2)+exp(psi3)); a2=exp(psi3)/(20+exp(psi2)+exp(psi3)) deriv.psi1<-numericDeriv(a0,c("psi1","psi2","psi3")); deriv.psi2<-numericDeriv(a1,c("psi1","psi2","psi3")); deriv.psi3<-numericDeriv(a2,c("psi1","psi2","psi3")); but I found, > deriv.psi1<-numericDeriv(a0,c(&quot...
2003 Aug 14
0
Bug in numericDeriv (was: [R] nls confidence intervals) (PR#3746)
....com> wrote : >p.s. The following command in S-Plus 6.1 seems to work fine but >produces an error in R 1.7.1: > >nls(y~a, data=tstDf, start=list(a=1)) >Error in nlsModel(formula, mf, start) : singular gradient matrix at >initial parameter estimates This looks like a bug in numericDeriv, which finds a derivative of 0 rather than 1 for da/da. I've cc'd the author. Duncan
2010 Jul 06
2
numerical derivative R help
...obability density.I will really appreciate your help reagrding the error messages I am getting which I don't understand. * * > fitterma <- function(xtime) { a <- -0.09144115 b <- -0.01335756 c <- -2.368057 d <- -0.00600052 return(exp(a+b*xtime)+exp(c+d*xtime)) } > numericDeriv(fitterma,"xtime") *Error in numericDeriv(fitterma, "xtime") : * * cannot coerce type 'closure' to vector of type 'double'* * * *Thanks,* *parmee* [[alternative HTML version deleted]]
2006 Mar 12
2
Numerical Derivatives in R
Hi, Suppose I have an arbitrary function: arbfun<-function(x) {...} Is there a robust implementation of a numerical derivative routine in R which I can use to take it's derivative ? Something a bit more than simple division by delta of the difference of evaluating the function at x and x+delta... Perhaps there is a way to do this using D or deriv but I could not figure it out.
2005 May 05
2
Numerical Derivative / Numerical Differentiation of unkno wn funct ion
...mentation ? Will this work then ? -----Original Message----- From: Berton Gunter [mailto:gunter.berton at gene.com] Sent: 05 May 2005 23:34 To: 'Uzuner, Tolga'; r-help at stat.math.ethz.ch Subject: RE: [R] Numerical Derivative / Numerical Differentiation of unknown funct ion But... See ?numericDeriv which already does it via a C call and hence is much faster (and probably more accurate,too). -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA "The business of the statistician is to catalyze the scientific learning process." - George E. P. Box > ----...
2010 Oct 13
2
Using NLS with a Kappa function
Hi Everyone, I am trying to use NLS to fit a dataset using a Kappa function, but I am having problems. Depending on the start values that I provide, I get either: Error in numericDeriv(form[[3L]], names(ind), env) : Missing value or an infinity produced when evaluating the model Or Error in nls(FldFatRate ~ funct3(MeanDepth_m, h, k, z, a), data = data1, : singular gradient I think these error results from the fact that I obtained a good fit with a logistic function and that th...
2003 Mar 26
1
nls
Hi, df <- read.table("data.txt", header=T); library(nls); fm <- nls(y ~ a*(x+d)^(-b), df, start=list(a=max(df->y,na.rm=T)/2,b=1,d=0)); I was using the following routine which was giving Singular Gradient, Error in numericDeriv(form[[3]], names(ind), env) : Missing value or an Infinity produced when evaluating the model errors. I also tried the below method given by Dr. Dougla Bates. But still am getting the error. Error in numericDeriv(form[[3]], names(ind), env) : Missing value or an Infini...