Displaying 20 results from an estimated 10000 matches similar to: "Suggestion for the optimization code"
2008 Aug 06
1
Numerical optimisation and "non-feasible" regions
Dear list,
I'm currently writing a C code to compute the (composite) likelihood -
well this is done but not really robust. The C code is wrapped in an R
one which call the optimizer routine - optim or nlm. However, the
fitting procedure is far from being robust as the parameter space
depends on the parameter - I have a covariance matrix that should be a
valid one for example.
Currently,
2008 Jul 05
3
Editing the "..." argument
Dear all,
I'd like tweaking the ... arguments that one user can pass in my
function for fitting a model. More precisely, my objective function is
(really) problematic to optimize using the "optim" function.
Consequently, I'd like to add in the "control" argument of the latter
function a "ndeps = rep(something, #par)" and/or "parscale =
2008 Apr 06
2
Matrix multiplication in a C code
Dear list members,
I've got a small question on matrix multiplications in a C code. Because
of a really cpu demanding likelihood, I had to use a C code within an R
function wrapper. I'm pretty sure that there is already one good code
for matrix multiplication in C - maybe in the R source code itself - but
I wasn't able to find it.
Anyone as an idea on how to handle matrix
2008 Apr 21
4
prod(0, 1:1000) ; 0 * Inf etc
I think most of us would expect prod(0:1000) to return 0, and ...
... it does.
However, many of us also expect
prod(x1, x2) to be equivalent to
prod(c(x1,x2))
the same as we can expect that for min(), max(), sum() and such
members of the "Summary" group.
Consequently, prod(0, 1:1000) should also return 0,
but as you see, it gives NaN which may be a bit puzzling...
The
2008 May 09
1
Have you ever experienced this problem with REAL in a C code
Dear all,
I'm currently experiencing big troubles with my C code called by .Call
in a R function.
I know this may not be the right place for such things but these errors
are driving me crazy. And I hope other people may have already
experienced these problems so that they could give me good suggestions.
Sorry if I'm completely out of topic.
Well let's go...
I'm writing a
2009 Oct 10
2
Possible bug in the Rd parser?
Dear list,
I got an automatic email complaining than some of my packages didn't
pass 'R CMD check' for R-2.10.0 alpha anymore. Both of them make use of
the "cases" LaTeX environment.
Inspecting the log outputs I got:
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! Misplaced alignment tab
2005 Dec 04
1
Understanding nonlinear optimization and Rosenbrock's banana valley function?
GENERAL REFERENCE ON NONLINEAR OPTIMIZATION?
What are your favorite references on nonlinear optimization? I like
Bates and Watts (1988) Nonlinear Regression Analysis and Its
Applications (Wiley), especially for its key insights regarding
parameter effects vs. intrinsic curvature. Before I spent time and
money on several of the refences cited on the help pages for "optim",
2004 Aug 03
1
nlminb vs optim
Dear R-help group,
I have to maximize a likelihood with 40 parameters and I want to compare
the MLE given by "nlminb" (Splus2000, on Windows) with those given by
"optim" (R, on Unix).
1) On Splus,
The algorithm "nlminb" seems to converge (the parameters stabilize) , it
stops after several iterations ( around 400) with the message :"FUNCTION
EVALUATION LIMIT
2008 Dec 11
5
package development
I'm making the move of the survival package from my own environment to,
and have stumbled into a vacuum. The R Extensions manual has really nice
instructions about how to lay out the directories, order the files, and
run tests for DISTRIBUTION of a product, but I can't find anything on how
to set up a reasonable DEVELOPMENT environment.
In my local world, I had the .c and .s files in
2008 Jun 11
1
difference between nlm and nlminb
Hi,
I was wondering if someone could give a brief, big picture overview of the difference between the two optimization functions nlm and nlminb. I'm not familiar with PORT routines, so I was hoping someone could give an explanation.
Thanks,
Angelo
_________________________________________________________________
Instantly invite friends from Facebook and other social networks to join yo
2012 Feb 22
3
OpenMP and random number generation
Dear all,
Now that R has OpenMP facilities, I'm trying to use it for my own package but I'm still wondering if it is safe to use random number generation within a OpenMP block. I looked at the R writing extension document both on the OpenMP and Random number generation but didn't find any information about that.
Could someone tell me if it is safe or not please ?
Best,
Mathieu
2010 Mar 24
1
vcov.nlminb
Hello all,
I am trying to get the variance-covariance (VCOV) matrix of the
parameter estimates produced from the nlminb minimizing function, using
vcov.nlminb, but it seems to have been expunged from the MASS library.
The hessian from nlminb is also producing NaNs, although the estimates
seems to be right, so I can't VCOV that way either. I also tried using
the vcov function after minimizing
2005 Dec 13
2
what does this warnings mean? and what should I do?
I use lmer to fit a mixed effect model.It give some warnings.what does this warnings mean? and what should I do?
> (fm2.mlm <- lmer(qd ~ edu + jiankang + peixun +hunyin + cadcj + age + age2 + sex + dangyuan + Comp.1 + Comp.2+trust.cz1 +(trust.cz1|commid), data = individual,na.action = "na.exclude",family="quasibinomial"))
Generalized linear mixed model fit using PQL
2009 Nov 29
1
optim or nlminb for minimization, which to believe?
I have constructed the function mml2 (below) based on the likelihood function described in the minimal latex I have pasted below for anyone who wants to look at it. This function finds parameter estimates for a basic Rasch (IRT) model. Using the function without the gradient, using either nlminb or optim returns the correct parameter estimates and, in the case of optim, the correct standard
2005 Nov 21
1
singular convergence with lmer function i lme4
Dear R users,
I am trying to fit a GLMM to the following dataset;
tab
a b c
1 1 0.6 199320100313
2 1 0.8 199427100412
3 1 0.8 199427202112
4 1 0.2 199428100611
5 1 1.0 199428101011
6 1 0.8 199428101111
7 0 0.8 199527103011
8 1 0.6 199527200711
9 0 0.8 199527202411
10 0 0.6 199529100412
11 1 0.2 199626201111
12 2 0.8 199627200612
13 1 0.4 199628100111
14 1 0.8
2009 Jan 08
1
legend() in a multiple figure environment
Dear all,
there seems to be a problem with displayed legends when a multiple
figure environment is used, see the following example:
par(mfrow=c(1,2))
curve(dnorm,col=4,from=-4,to=4);
legend(-4,0.3,legend="curve",lty=1,col=4)
legend(-4,0.2,legend="curve",lty=1,col=4)
On my machines the first time the command legend() is issued the
legend box stretches over the curve.
2009 Feb 12
1
Setting optimizer in lme
I am using R 2.7.0 on a linux platform.
I am trying to reproduce a 2002 example using lme from the nlme library.
I want to change the otimizer from the default (nlminb) to optim.
Specifically, this is what I am trying to do:
R> library(nlme)
R> library(car) # for data only
R> data(Blackmoor) # from car
R> Blackmoor$log.exercise <- log(Blackmoor$exercise + 5/60, 2)
R>
2005 Dec 14
2
suggestions for nls error: false convergence
Hi,
I'm trying to fit some data using a logistic function defined as
y ~ a * (1+m*exp(-x/tau)) / (1+n*exp(-x/tau)
My data is below:
x <- 1:100
y <- c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,1,1,1,2,2,2,2,2,3,4,4,4,5,
5,5,5,6,6,6,6,6,8,8,9,9,10,13,14,16,19,21,
24,28,33,40,42,44,50,54,69,70,93,96,110,127,127,141,157,169,
2011 Aug 16
2
Calibrating the risk free interest rate using nlminb
Dear R-users
I am trying to find a value for the risk free rate minimizing the difference
between a BS call value with impl. volatilities minus the market price of a
call (assuming this is just the average bid ask price)
Here is my data:
http://r.789695.n4.nabble.com/file/n3747509/S%26P_500_calls%2C_jan-jun_2010.csv
S%26P_500_calls%2C_jan-jun_2010.csv
S0 <- 1136.03
q <- 0.02145608
S0
2019 Feb 01
3
nlminb with constraints failing on some platforms
Hello,
R 3.5.2 on ubuntu 18.04. sessionInfo() at the end.
Works with me, same results, cannot reproduce the error.
f <- function(x) sum( log(diff(x)^2+.01) + (x[1]-1)^2 )
opt <- nlminb(rep(0, 10), f, lower=-1, upper=3)
str(opt)
xhat <- rep(1, 10)
all.equal(opt$par, xhat, tol=0) # good: 5.53 e-7
#[1] "Mean relative difference: 5.534757e-07"
all.equal(opt$objective,