similar to: Question on deriv3()

Displaying 20 results from an estimated 6000 matches similar to: "Question on deriv3()"

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 is also obtained when requesting for the Hessian of
2007 Mar 02
2
nlm() problem : extra parameters
Hello: Below is a toy logistic regression problem. When I wrote my own code, Newton-Raphson converged in three iterations using both the gradient and the Hessian and the starting values given below. But I can't get nlm() to work! I would much appreciate any help. > x [1] 10.2 7.7 5.1 3.8 2.6 > y [1] 9 8 3 2 1 > n [1] 10 9 6 8 10 derfs4=function(b,x,y,n) {
2007 Mar 08
1
Calling Optim() from C
Hello: I am sure this question was dealt with several years ago. Is the function vmmin() available from Rmath Standalone? If not is it possible to call optim() or nlm() from Rmath in C. Thank you. Mervyn
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",
2002 Mar 11
1
problem with deriv3?
Using S+ 6 for Linux and R 1.4.1 Taking verbatim some 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 <-
2011 May 26
0
Using deriv3() in a separated nonlinear regression model
Hi all, I'm adjusting a nonlinear regression model for data that has a categorigal variable present. So, I can use nls() to do this considering the categorical variable, like this #------------------------------------------------------------ da <- expand.grid(tr=gl(2,1,la=c("tr")), x=1:12) da$y <- 10*da$x/(3+da$x)+rnorm(da$x,0,0.1) plot(y~x, da) n0 <-
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
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:
2007 Jul 30
2
deriv, loop
Hi, 2 questions: Question 1: example of what I currently do: for(i in 1:6){sink("temp.txt",append=TRUE) dput(i+0) sink()} x=scan(file="temp.txt") print(prod(x)) file.remove("C:/R-2.5.0/temp.txt") But how to convert the output of the loop to a vector that I can manipulate (by prod or sum etc), without having to write and append to a file? Question 2: >
2007 Oct 26
5
help
hello, please can anyone help me out. Am a new user of R program. Am having problem with this code below, not getting the expected results. 1. Each m, the cumulative sum should be 1.000 but the 2nd and 3rd m returned 2.000 and 3.000 instead of 1.000. 2. to get the LCL(m) and UCL(m) for each m base on these instructions if out.cum > 0.025 then LCL(m)= y-1 if out.cum >0.975
2007 Oct 29
2
help please
hello, please can anyone help me out. Am a new user of R program. Am having problem with this code below, not getting the expected results. Each m, the cumulative sum should be 1.000 but the 2nd and 3rd m returned 2.000 and 3.000 instead of 1.000. thanks Aruike pp=function(x,n,M){z=1.0;a=2.3071430;b=7.266064;H=3 out.h=c() out.y=c() out.m=c() out.prob=c()
2011 Aug 17
1
multinomRob - error message
Hi, I would like to use the multinomRob function to test election results. However, depending on which independent variables I include and how many categories I have in the dependent variable, the model cannot be estimated. My data look like this (there are 68 observations): > head(database) RESTE09 GAUCHE09 PDC09 PLR09 UDC09 MCG09 RESTE05 GAUCHE05 PDC05 D1 1455
2006 Jul 22
1
ifelse command
Dear: I try to revise the maximum likelihood function below using something constrains. But it seems something wrong with it. Becasue R would not allow me to edit the function like this. It is very appreciate if you can help. function (parameters,y,x1,x2) { p<-parameters[1] alpha1<-parameters[2] beta1<-parameters[3)] delta1<-parameters[4] alpha2<-parameters[5]
2005 Jul 03
2
over/under flow
I am porting some FORTRAN to R in which an Inf triggers an if(). The trigger is infinite on exp(lgamma(OVER)). What is the canonical R style of determining OVER when exp(OVER)== Inf? The code structure that I am porting is best left intact--so I need to query R somehow to the value of OVER that causes exp(lgamma(OVER)) to equal Inf. On my system, exp(lgamma(171)) is about first to equal Inf.
2009 Apr 22
2
integrate lgamma from 0 to Inf
Dear R users, i try to integrate lgamma from 0 to Inf. But here i get the message "roundoff error is detected in the extrapolation table", if i use 1.0e120 instead of Inf the computation works, but this is against the suggestion of integrates help information to use Inf explicitly. Using stirlings approximation doesnt bring the solution too. ## Stirlings approximation lgammaApprox
1998 Sep 10
2
R-beta: trouble compiling 0.62.3 on SunOS 4.1.4: lgamma conflicts
I've recently tried to get 0.62.3 up on our Suns (4.1.4, using gcc; I'm also having trouble with a Solaris 2.6 compile but I haven't given up hope on that one yet) -- the last compile I did was 0.61.1, which worked smoothly. Running ./configure --prefix=/usr/local/apps/R/R-0.62.3 [--with-g77] (tried both with and without g77, eventually get to the same place), I get a conflict
2017 Feb 17
4
Wish List: Extensions to the derivatives table
The derivative table resides in the function D. In S+ that table is extensible because it is written in the S language. R is faster but less flexible, since that table is programmed in C. It would be useful if R provided a mechanism for extending the derivative table, or barring that, provided a broader table. Currently unsupported mathematical functions of one argument include expm1, log1p,
2008 Apr 18
3
help me to debug this part of code?
I am trying to solve the integration equation, for different values of K from 4 to 25, the integration is with respect to u, Here is the equation: gamma(k/2) / ( sqrt(k-1)*gamma((k-1)/2) ) * integrate(f= (1+u^2/k-1)^(-k/2), lower=0, upper= sqrt(a^2*k/(k+1-a^2)) ) = the similar expression as te left hand except k becomes k+1 my code is below, I don't know why R keep telling me the syntax
2004 Jun 26
1
S4 group "Math", "getGroupMembers", "genericForPrimitive"
Hi, I found the following on Windows 2000/NT R Version 1.9.1 (2004-06-21) (also Version 1.9.0): The S4 group "Math" doesn't work as documented; i.e., "log", "log10", "gamma" and "lgamma" are included in the documentation but don't work. See example code below. Moreover, what about 'genericForPrimitive' which is used in
2006 Jul 22
1
Why the contrain does not work for selecting a particular range of data?
Dear: Continuing the issue of 'ifelse'! I selecting the data whose 'x2'=1 for maximizing likelihood. I used two way to do this but the results are different. 1.Way one I use the data for x2=1 and run the program. It works for me. Tthe program is described as below: function (parameters,y1,x11) { p<-parameters[1] alpha1<-parameters[2] beta1<-parameters[3]