Displaying 20 results from an estimated 1400 matches similar to: "Problems with the commands FUNCTION and DERIV to build a polynomial"
2009 Sep 12
4
Normal distribution
Dear All
let me go one step further by asking you if you could help me show that the distribution of this data in normal. have a little idea (by trial and error) but i seem to not fully understand how its done.
H<-rnorm(100, mean=50000, sd=3000)
par(las=1)
hist(H, breaks=seq(40000, 60000, 1000), freq=F)
f<- function(x) exp(-(x-5000)^2/18000000)/sqrt(18000000*pi)
x<- seq(40000,
2011 Apr 04
1
Deriving formula with deriv
Dear list,
Hi,
I am trying to get the second derivative of a logistic formula, in R summary
the model is given as :
###
>$nls
>Nonlinear regression model
>model: data ~ logistic(time, A, mu, lambda, addpar)
>data: parent.frame()
> A mu lambda
>0.53243 0.03741 6.94296
###
but I know the formula used is
#
2012 Jan 03
1
higher derivatives using deriv
Dear everyone,
the following 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,
2011 Nov 17
3
Obtaining a derivative of nls() SSlogis function
Hello, I am wondering if someone can help me. I have the following function
that I derived using nls() SSlogis. I would like to find its derivative. I
thought I had done 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)))
2001 May 28
0
bugs in deriv(*, *, function.arg = ) (PR#953)
Also, this should have gone in R-bugs quite a while ago :
------- start of forwarded message -------
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-core@stat.math.ethz.ch
Subject: PROTECT() bugs in deriv(*, *, function.arg = )
Date: Mon, 16 Apr 2001 21:02:10 +0200
In R versions 0.50 and 0.64.2 ,
the following worked
> deriv(expression(sin(cos(x) * y)),
2010 Nov 23
1
Barplot and plot means with confidence intervals in the same plot
I want to obtain a barplot with error bars and a mean plot with error bars
with other scale on the left in the same plot. I need help to get the same
x axis (centered) when overlay two plots (barplot2 and plotCI (or
lineplot.CI) with errorbars), with diferent y axis. I use par (new=T) but
the X axis names are not centered with the figures.
An example of my data:
2008 Dec 27
1
indexed expression
Hello expeRts,
I need generate symbolize the autocovariances matrix of a Gaussian
ARMA(1,1), for derivate it and evaluate.
I try this codes, but whitout sucess
vacv<-NULL
vacv[1]<-1-2*phi*theta-theta^2
vacv[2]<-(1-phi*theta)*(phi-theta)
vacv[3:n]<-acv[2]*(phi^(1:(n-2)))
facv<-list()
for(i in 1:2)
2006 Apr 20
2
nlminb( ) : one compartment open PK model
All,
I have been able to successfully use the optim( ) function with
"L-BFGS-B" to find reasonable parameters for a one-compartment
open pharmacokinetic model. My loss function in this case was
squared error, and I made no assumptions about the distribution
of the plasma values. The model appeared to fit pretty well.
Out of curiosity, I decided to try to use nlminb( ) applied to
a
2008 Oct 23
2
PCA
Hi,
I'm trying to perform a Principal Component Analysis on meteorological
data with 10 predictors.
I use the library pcaMethods to obtain a lot of information (loadings,
scores, mean, standard deviation, etc).
How can I obtain the scores (new PC variables) for new values of weather
predictors using the results of PCA analysis (loadings, mean value,
standard deviation) and without
2018 Apr 07
0
Obtain gradient at multiple values for exponential decay model
I have never found the R symbolic differentiation helpful because my
functions are typically quite complicated, but was prompted by Steve
Ellison's suggestion to try it out in this case:
################# reprex (see reprex package)
graphdta <- read.csv( text =
"t,c
0,100
40,78
80,59
120,38
160,25
200,21
240,16
280,12
320,10
360,9
400,7
", header = TRUE )
nd <- c( 100, 250,
2008 Apr 29
1
generic question ==>> mapping Longhurst biogeochemical ocean provinces in R
*Hello all
**
I am a newbie to R plotting maps. I am trying to plot over a world map a
layer of Biogeochemical provinces (BGCP) by A.R. Longhurst. Each ocean
region unfortunately are quite irregular in shape (not perfect squares). In
GIS this layer of ocean provinces would be a layer of polygons, which I am
assuming it cannot be plotted with R.
I was wondering If anybody has encounter this
2009 Mar 06
1
Interpreting GLM coefficients
Hi all,
I?m fitting GLM?s and I can?t interprete the coefficients when I run a
model with interaction terms.
When I run the simpliest model there is no problem:
Model1<-glm (Fishes ~ Year + I(Year^2) + Kind.Geographic +
Kind.Fishers + Zone.2 + Hours + Fishers + Month, family =
poisson(log)) # Fishes, Year, Hours, and Fishers are numeric,
Kind.Geographic, Kind.Fishers, Zone.2 and
2009 Feb 08
0
recursive derivative a list of polynomials
Dear list,
This is quite a specific question requiring the package orthopolynom.
This package provides a nice implementation of the Legendre
polynomials, however I need the associated Legendre polynomial which
can be readily expressed in terms of the mth order derivative of the
corresponding Legendre polynomial. (For the curious, I'm trying to
calculate spherical harmonics [*]).
2010 Jul 29
2
how to get higher derivatives with "deriv"
Dear ExpeRts,
I have trouble implementing a function which computes the k-th derivative of a specified function f and returns it as a function. I tried to adapt what I found under ?deriv but could not get it to work. Here is how it should look like:
## specify the function
f <- function (x,alpha) x^alpha
## higher derivatives
DD <- function(expr, variable, order = 1) {
if(order <
2007 Jan 12
1
incorrect result of deriv (PR#9449)
Full_Name: Joerg Polzehl
Version: 2.3.1
OS: x86_64, linux-gnu
Submission from: (NULL) (62.141.176.22)
I observed an incorrect behavior of function deriv when evaluating arguments of
dnorm
deriv(~dnorm(z,0,s),"z")
expression({
.value <- dnorm(z, 0, s)
.grad <- array(0, c(length(.value), 1), list(NULL, c("z")))
.grad[, "z"] <- -(z * dnorm(z))
2002 Apr 22
1
predict.*bSpline() bugs extrapolating for deriv >= 1 (PR#1473)
I've already fixed the bugs, but as with the last one, this is
not critical enough to allow breaking current R-devel's code
freeze. I hope I will have corrected it for 1.5.1..
## Here is code reproducing the problems;
## I use try(.) whenever I know the current versions of R would
## give an error:
library(splines)
x <- c(1:3,5:6)
y <- c(3:1,5:6)
(isP <- interpSpline(x,y))#
2001 Oct 07
1
Bug in Deriv? (PR#1119)
deriv seems to have problems with a minus-sign before a bracket.
Below are four examples of the same function, the top one
is wrong, all others are correct (hopefully).
Rest of expression not shown, it is the same for all versions.
_
platform i386-pc-mingw32
arch x86
os Win32
system x86, Win32
status
major 1
minor 3.0
year 2001
month 06
day 22
language R
2006 Nov 03
1
Using a deriv function in nlme
Hello,
I have a deriv function that I am feeding to nlme. It works, and I can use
it in nls, but when I try to use it in nlme I get Error: subscript out of
bounds. I can fit the model using SSasympOrig, instead of the deriv
function, but I am trying to reproduce an earlier analysis (done in Splus)
and I get slightly different results with SSasympOrig.
Here are my calls:
This does fit
2002 Jul 04
1
Deriv and integrate
Dear R users,
I would like to express a function (with only one argument) as the integrate of its derivate.
For example, for y=x^2, I would like something like
integrate(deriv(~x^2,"x", function(x) NULL, formal=T),0,2)
which would give me... 4.
Thank you,
Tristan
----------------------
?cole Nationale V?t?rinaire d'Alfort - http://www.vet-alfort.fr,
T?l. 01 43 96 70 33
M?l.
2005 Jul 19
1
deriv - accessing numeric output listed under gradient attribute
Hi,
I am interested in using the numeric output from the "gradient" attribute of
deriv's output in subsequent analyses.
But, I have so far been unable to determine how to do so.
I will use the example from the deriv help to illustrate.
> ## function with defaulted arguments:
> (fx <- deriv(y ~ b0 + b1 * 2^(-x/th), c("b0", "b1", "th"),