Displaying 13 results from an estimated 13 matches for "namevec".
2011 Nov 17
3
Obtaining a derivative of nls() SSlogis function
...this using deriv(), but for some reason this isn't
working out for me.
Here is the function:
asym <- 84.951
xmid <- 66.90742
scal <- -6.3
x.seq <- seq(1, 153,, 153)
nls.fn <- asym/((1+exp((xmid-x.seq)/scal)))
try #1
deriv(nls.fn)
#get an Error in .Internal(deriv.default(expr, namevec, function.arg, tag,
hessian)) : 'namevec' is missing
try #2
deriv(nls.fn, namevec=c("asym", "xmid", "scal"))
#this doesn't seem to give me the expression, and the gradients are zero.
I've tried to do this with Ryacas as well, but I'm lost.
Can an...
2010 Aug 04
4
Adding collumn to existing data frame
Hi experts,
I am trying to write a very flexible method that allows me to add a
new column to an existing data frame. This is what I have so far:
add.column <- function(df, new.col, name) {
n.row <- dim(df)[1]
length(new.col) <- n.row
names(new.col) <- name
return(cbind(df, new.col))
}
df <- NULL
df <- data.frame(a=c(1,2,3))
df
# corect: added NA to new collumn
df <-
2008 Dec 27
1
indexed expression
...a"), function(phi, theta) { :
Funci?n '`[`' no est? en la tabla de derivadas
dfg<-for(n in 1:2) as.formula(sprintf("y~(1 - phi * theta) * (phi -
theta)*phi^ %d",n))
dfg
y ~ (1 - phi * theta) * (phi - theta) * phi^2
deriv(dfg[[1]],phi)
Erro en deriv.default(expr, namevec, function.arg, tag, hessian) :
nombres de variable inv?lidos
Give me a help, please.
Bernardo.
2011 Apr 04
1
Deriving formula with deriv
...ress
expression(y ~ "A"/(1 + exp((4 * "mu"/"A") * ("lambda" - "time")) +
2))
>
> d1<-deriv(express)
Error in deriv.default(express) : element 2 is empty;
the part of the args list of '.Internal' being evaluated was:
(expr, namevec, function.arg, tag, hessian)
####
Why is this not working and how do I get the second derivative?
Thank you for reading my post, all help is appreciated,
Kitty
[[alternative HTML version deleted]]
2012 Jan 03
1
higher derivatives using deriv
...is obviously used to compute the nth derivative, which seems
to work
(deriv(sqrt(1 - x^2),x,n))
However, before using this, I wanted to make sure it does what I think it
does
but can't figure it out when reading the ?deriv info or any other
documentation on deriv for that matter:
deriv(expr, namevec, function.arg = NULL, tag = ".expr", hessian = FALSE,
...)
This doesn't seem to include an "order of derivative" argument, in fact, in
the examples section,
it is outlined, how one can build a higher deriv. function oneself...
Any hints are much appreciated!
alex
--
View t...
2009 Sep 17
1
Problems with the commands FUNCTION and DERIV to build a polynomial
...ients to build the polynomial.
coef<-as.matrix(model1$coefficients)
In the next step I need to define the polynomial to derive it. If I write
the coefficients manually (writing the numbers by hand) the deriv command
works fine!
bb<-deriv(~2847.22015 -463.06063*x+ 25.43829*x^2 -0.17896*x^3, namevec="x",
function.arg=40)
I would like to automate this step by being able to extract the coefficients
from the linear model and adding them into the polynomial (and not write
them by hand)!
But if I build the polynomial with the function(x) command calling the *
coef* values, the numeric...
2005 Jan 05
10
variance of combinations of means - off topic
Hello, and please excuse this off-topic question, but I have not been
able to find an answer elsewhere. Consider a value Z that is calculated
using the product (or ratio) of two means X_mean and Y_mean:
Z=X_mean*Y_mean. More generally, Z=f(X_mean, Y_mean). The standard
error of Z will be a function of the standard errors of the means of X
and Y. I want to calculate this se of Z. Can someone
2006 Apr 20
2
nlminb( ) : one compartment open PK model
...^2
likelihood <- const*exp(exponent)
#defining the merit function
-sum(log(likelihood))
}
deriv2
<- deriv( expr = ~ -log(1/(sqrt(2*pi)*S)*exp((-1/(2*(S^2)))*
(log.conc-(log(dose*Ke*Ka/(Cl*(Ka-Ke)))
+log(exp(-Ke*time)-exp(-Ka*time))))^2)),
namevec = c("Ke","Ka","Cl","S"),
function.arg = function(Ke, Ka, Cl, S, dose, time, log.conc) NULL )
gradient2.1compart <- function(parms, dose, time, log.conc)
{
Ke <- parms[1]; Ka <- parms[2]; Cl <- parms[3]; S <- parms[4]
colSums(attr(deriv2.1...
2018 Apr 07
0
Obtain gradient at multiple values for exponential decay model
...* exp( a + b*t )
graphmodeldpdt <- coef( graphmodeld )[ 2 ] * graphmodelp
graphmodeldpdt
#> 1 2 3
#> -0.31464113 -0.11310757 -0.08042364
# Ellison suggestion - fancy, only works for simple functions
dc <- deriv( expression( exp( a + b * t ) )
, namevec = "t"
)
dcf <- function( t ) {
cgm <- coef( graphmodeld )
a <- cgm[ 1 ]
b <- cgm[ 2 ]
eval(dc)
}
result <- dcf( nd )
result
#> [1] 46.13085 16.58317 11.79125
#> attr(,"gradient")
#> t
#> [1,] -0.31464113
#> [2,...
2001 May 28
0
bugs in deriv(*, *, function.arg = ) (PR#953)
...0.65.1,
and later someone added to help(deriv) 's description of function.arg
\item{function.arg}{If specified, a character vector of arguments for
a function return, or a function (with empty body) or \code{TRUE},
the latter indicating that a function with argument names
\code{namevec} should be used.
the comment
>>>> \bold{Note:} this is incompatible with S.}
Today, I've been looking a bit at the C code and I can't understand why
giving the function.arg as a function doesn't work anymore.
(it just returns the 'empty' fun...
2018 Apr 06
3
Obtain gradient at multiple values for exponential decay model
> On Apr 6, 2018, at 8:03 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>
>
>> On Apr 6, 2018, at 3:43 AM, g l <gnulinux at gmx.com> wrote:
>>
>>> Sent: Friday, April 06, 2018 at 5:55 AM
>>> From: "David Winsemius" <dwinsemius at comcast.net>
>>>
>>>
>>> Not correct. You already have
2007 Oct 22
3
Elasticity in Leslie Matrix
Dear R-users,
I would like to calculate elasticities and sensitivities of each parameters
involved in the following transition matrix:
A <- matrix(c(
sigma*s0*f1, sigma*s0*f2,
s, v
), nrow=2, byrow=TRUE,dimnames=list(stage,stage))
The command "eigen.analysis" avaliable in package "popbio" provides
sensibility matrix and elasticity matrix
2000 Sep 24
2
Folding ?
Hi,
I need to write a function that would look something like this:
S <- function(b=betas){
expression(b[1] * f(b[2] * x * f(b[3] * x * f(...b[n-1] * x * f(b[n] *
x)))...)
}
Where n is the number of element in b.
Further I need to be able to evaluate S at some x numerically of course and
I need to use "deriv" and produce dS/dx such that I can evaluate it also at
some x.
I