Displaying 20 results from an estimated 26 matches for "deriv3".
Did you mean:
derivs
2001 May 06
1
deriv3 example on Venables/Ripley page 263
What does it require to run the example on page 263
of Venables/Ripley book using R 1.3.0?
I got the following error and I have no clue how to correct it.
Thank you very much. (If you reply to the list, please send a
copy to me.)
> lmix2 <- deriv3(
+ ~ -log(p*dnorm((x-u1)/s1)/s1 + (1-p)*dnorm((x-u2)/s2)/s2),
+ c("p", "u1", "s1", "u2", "s2"),
+ function(x, p, u1, s1, u2, s2) NULL)
Error in deriv3.formula(~-log(p * dnorm((x - u1)/s1)/s1 + (1 - p) * dnorm((x - :
Function H is not in...
2002 Mar 11
1
problem with deriv3?
...me lines from S-Plus that work
perfectly, and running them on R, I get an
unexpected error message:
R : Copyright 2002, The R Development Core Team
Version 1.4.1 (2002-01-30)
> library(MASS)
> data <- read.table("/usr/local/data/mcmanus.dat",header=T)
> mcmanus.frm <-
deriv3(~-log(pnorm((2*D1-1)*(b0+b1*TT+b2*Y+b3*LF+b4*NW+b5*D2))),c("b0","b1","b
2","b3","b4","b5"),function(b0,b1,b2,b3,b4,b5,D1,TT,Y,LF,NW,D2) NULL)
Error in deriv3.formula(~-log(pnorm((2 * D1 - 1) * (b0 + b1 * TT + b2 * :
Function ^A is not...
2004 Mar 24
1
Question on deriv3()
Hello:
Why is deriv3() functioning differently in R from that in Splus
using library(MASS) ? For example
deriv3(~(t1*log(t2)+lgamma(t1)+(1-t1)*log(y)+y/t2),c("t1","t2"),function(y,t1,t2)NULL)
complains of lgamma.
Mervyn
2017 Feb 17
4
Wish List: Extensions to the derivatives table
...er table. Currently unsupported mathematical functions of one argument include expm1, log1p, log2, log10, cospi, sinpi, and tanpi.
While manual differentiation of these proposed additions is straight-forward, their absence complicates what otherwise could be much simpler, such as using deriv() or deriv3() to generate functions, for example to use as an nls model.
Thanks,
[[alternative HTML version deleted]]
2007 Mar 20
2
Problems about Derivaties
Dear participants to the list,
this is my problem: I want to obtain an expression that represents the second
derivative of one function.
With "deriv3" (package "stats") it is possible to evaluate the second
derivative, but I do not know how I can get the (analytical) expression of this
derivative.
For example: Suppose that I have a function of this form:
f(x,y)=x^3+y^3+(x^2)*(y^2). With "deriv3" I can evaluate the first...
2011 May 26
0
Using deriv3() in a separated nonlinear regression model
...y~x, da)
n0 <- nls(y~A[tr]*x/(B[tr]+x), data=da,
start=list(A=c(10,10), B=c(3,3)), trace=TRUE)
summary(n0)
attr(n0$m$fitted(), "gradient")
attr(n0$m$fitted(), "hessian")
#------------------------------------------------------------
but I want specify a model using deriv3() function because I use the
gradient and hessian of the model fit
#------------------------------------------------------------
model <- deriv3(~A*x/(B+x), c("A","B"), function(x, A, B) NULL)
n1 <- nls(y~model(x, A, B), data=da,
start=list(A=c(10), B=c(3)), tra...
2017 Feb 17
1
Wish List: Extensions to the derivatives table
The issue is that without an extensible derivative table or the proposed extensions, it is not possible to automatically produce (without manual modification of the deriv3 output) a function that avoids catastrophic cancellation regardless of the working range.
Manual modification is not onerous as a one-time exercise, but can be time consuming when it must be done numerous times, for example when evaluating the impact of different parameterizations on parameter eff...
2007 Oct 14
1
Extending deriv3()
Hello,
I was wondering if the functions deriv3(), deriv() etc. could be extended
to handle psigamma() and its special cases (digamma(), trigamma()
etc.). From the error message it seems that 'psigamma' needs to be
added to the derivatives table.
This might be easy since psigamma() has a deriv argument.
Additionally, this error message...
2007 Jul 30
2
deriv, loop
...riv(~gamma(x),"x")
expression({
.expr1 <- gamma(x)
.value <- .expr1
.grad <- array(0, c(length(.value), 1), list(NULL, c("x")))
.grad[, "x"] <- .expr1 * psigamma(x)
attr(.value, "gradient") <- .grad
.value
})
BUT
> deriv3(~gamma(x),"x")
Error in deriv3.formula(~gamma(x), "x") : Function 'psigamma' is not in the
derivatives table
What I want is the expression for the second derivative (which I believe is
trigamma(x), or psigamma(x,1)), how can I obtain that?
Thanks
--
View this message...
2017 Feb 17
0
Wish List: Extensions to the derivatives table
Hi.
Unless I'm misremembering, log, exp, sin, cos, and tan are all handled in
deriv3. The functions listed are specially coded slightly more accurate
versions but can be substituted with native ones for which deriv/deriv3
will work automatically. I believe that if you write your functions using
log(a + 1) instead of log1p(a) or log(x) / log(2) instead of log2(x) deriv3
will work...
1998 Jan 12
0
Symbolic derivation
Wenyaun Xi <xi@keynes.econ.utah.edu> writes to S-news:
> I ran into some problems when I tried to get symbolic derivation by
> using a function deriv3(). The expression contains 18
> parameters, of which I want to have an information matrix eventually. I
> ran it on my 200MHz Pentium PC with 64meg RAM. Each time I kick out the
> job, the S-plus 3.1 for Windows stops after about 2 hour of real time
> and suggests that it requires m...
2001 Sep 03
8
mixture distributions
Dear List,
I am looking for a possibility to fit a mixture model under R using
maximum likelihood estimation.
Venables and Ripley describe a solution working under S+ (in MASS, 3. ed.,
p. 263) which requires the D system function and deriv3. This solution does not
seem to be portable to R or at least I do not realise how.
Is there anyone who
a) knows how one could make the MASS-method run under R?
or
b) has written an EM-algorithm to fit mixture models in R that I could
use?
I would be glad to hear from someone.
Sincerely,
Jo...
2003 Oct 17
2
nlm, hessian, and derivatives in obj function?
...name, val )
}
lhs <- as.matrix( eval( as.formula( eqn )[[2]] ) )
rhs <- as.matrix( eval( as.formula( eqn )[[3]] ) )
resid <- crossprod( lhs - rhs )
## just how does this work...
attr( obj, "value" ) <- resid
attr( obj, "gradient" ) <- attr( eval( deriv3( eqn, names(
parmnames ) ) ), "gradient" )
}
res <- nlm( obj, sv2, hessian=T, eqn=supply2, data=kmenta, parmnames=sv2,
check.analyticals=T)
I haven't been able to get nlm to function as I keep getting the following
error message:
Error in nlm(obj, sv2, hessian = T, eqn = supply...
2004 Mar 10
1
Non-linear regression problem: R vs JMP (long)
...e same combination fails to
achieve convergence in R despite starting from the estimates reported in JMP.
What can I do?
Full story:
I am collaborating on a project which presently requires the fit of a seven
parameter non-linear function to 874 observations. The function is:
freeze.d <- deriv3(~ dbh^b * u^dbh * a1 * smi^a2 * exp(a3*pbal) *
(1 + a4*exp(a5*ba)) * cr^a6 * dh5^a7,
c("a1","a2","a3","a4","a5","a6","a7","b","u"),
function(dbh, smi, pbal, ba, cr, dh5, a1, a2, a3, a4, a5, a6, a7, b, u)...
2015 Mar 12
2
Requirement for pandoc 1.12.3 in R 3.1.3
...(x, base = 3)), "x") :
only single-argument calls are supported
Error in deriv.formula(~log(x, base = 3), "x") :
only single-argument calls are supported
Error in deriv.default(expression(log(x, base = 3)), "x") :
only single-argument calls are supported
Error in deriv3.default(expression(log(x, base = 3)), "x") :
only single-argument calls are supported
Error in D(expression(abs(x)), "x") :
Function 'abs' is not in the derivatives table
Error in deriv.formula(~abs(x), "x") :
Function 'abs' is not in the derivati...
2004 Aug 03
1
Using MASSv3's example from 8.7 in R?
...====
Example from MASSv3 8.7
=========================================================================
library(MASS)
data(geyser)
attach(geyser)
truehist(waiting, xlim=c(35,110), ymax=0.04, h=5)
width.SJ(waiting)
wait.dns <- density(waiting, 200, width=10.24)
lines(wait.dns, lty=2)
lmix2 <- deriv3(
~ -log(p*dnorm((x-u1)/s1)/s1 + (1-p)*dnorm((x-u2)/s2)/s2),
c("p", "u1", "s1", "u2", "s2"),
function(x, p, u1, s1, u2, s2) NULL)
p0 <- c(p=mean(waiting < 70), u1=50, s1=5, u2=80, s2=5)
tr.ms <- function(info, theta, grad, scal...
2006 Jul 31
0
Three questions about a model for possibly periodic data with varying amplitude
...ay, patient$protein, type="b")
My goal is two-fold: firstly, I need to test for periodicity, and
secondly, I need to try to predict the temporal location of future
peaks. Of course, the peaks might be occurring on unmeasured days.
I have been looking at this model:
wave.form <-
deriv3( ~ sin(2*pi*((day-offset)/period + 0.25)) * amplitude + mean,
c("period", "offset", "amplitude", "mean"),
function(day, period, offset, amplitude, mean){})
curve(wave.form(x, period=7, offset=2, mean=5, amplitude=4),
from=1, to=30)
S...
2006 Aug 15
1
A model for possibly periodic data with varying amplitude [repost, much edited]
...#################################################################
patient <- data.frame(
day = c(1, 3, 5, 8, 10, 12, 15, 17, 19, 22, 24, 26),
protein = c(5, 3, 10, 7, 2, 8, 25, 22, 7, 10, 12, 5)
)
plot(patient$day, patient$protein, type="b")
# This is my model:
wave.form <-
deriv3( ~ sin(2*pi*((day-offset)/period + 0.25)) * amplitude + mean,
c("period", "offset", "amplitude", "mean"),
function(day, period, offset, amplitude, mean){})
curve(wave.form(x, period=7, offset=2, mean=5, amplitude=4),
from=1, to=...
2015 Mar 12
0
Requirement for pandoc 1.12.3 in R 3.1.3
...:
> only single-argument calls are supported
> Error in deriv.formula(~log(x, base = 3), "x") :
> only single-argument calls are supported
> Error in deriv.default(expression(log(x, base = 3)), "x") :
> only single-argument calls are supported
> Error in deriv3.default(expression(log(x, base = 3)), "x") :
> only single-argument calls are supported
> Error in D(expression(abs(x)), "x") :
> Function 'abs' is not in the derivatives table
> Error in deriv.formula(~abs(x), "x") :
> Function 'abs...
2015 Mar 12
2
Requirement for pandoc 1.12.3 in R 3.1.3
Are other developers finding R 3.1.3 problematic because vignette
building requires pandoc 1.12.3, while Linux Mint 17 / Ubuntu 14.04 have
1.12.2.1? R 3.1.2 seems to work fine.
I'd very much like to avoid having to build as large a Linux package as
pandoc, which has given me issues outside of R (it leaves out words,
sentences or paragraphs when converting Latex to epub in a novel I'm