Displaying 20 results from an estimated 200 matches similar to: "bus error on calling nmmin"
2007 Oct 13
1
R API - optim
I am trying to use the R API to call optim functions (nmmin, vmmin, lbfgsb,
etc.) through a C program but I couldn't find the shared library to link
under the R-2.6.0 build which is compiled under Linux (REL5).
main.cpp:35: undefined reference to `Rf_initEmbeddedR(int, char**)'
main.cpp:41: undefined reference to `nmmin'
Thanks in advance for any help.
------------------------
2006 Mar 29
1
calling R's optimization routines from C
Hi,
I have read R's Writing Extensions manual and am still confused about how to
use some of the routines there when I call from C. Specifically, I am writing a
little test function which I will optimize using the nmmin function which
underlies R's optim() with Nelder-Mead. I guess I wonder what library/header
files I should be using. I was using R_ext/Applic.h and linking with libR but I
2008 Oct 31
0
R help for invoking nmmin()
My code is as follows:
#include <iostream>
#include <cmath>
using namespace std;
#define MATHLIB_STANDALONE 1
extern "C"
{
#include "R_ext/Applic.h"
}
typedef struct TT{
double ** tempX;
double * tempY;
int tempN;
} TT, *MM;
double fn(int N, double * beta, void * ex){
double total = 0;
int i = 0,j = 0;
double * betaFn = new double[N];
MM tmp = (MM)ex;
2008 Mar 07
1
parameters for lbfgsb (function for optimization)
Can anyone help me with lbfgsb (function for optimization)?
It takes the following parameters:
void lbfgsb (int n, int lmm, double *x, double *lower,
double *upper, int *nbd, double *Fmin, optimfn fn,
optimgr gr, int *fail, void *ex, double factr,
double pgtol, int *fncount, int *grcount,
int maxit, char *msg, int trace, int nREPORT);
What do I put for parameter ex (11th parameter)? I looked at
2008 Oct 03
1
Memory crash
Hello,
I get a segfault when running glmmboot in my own package glmmML. Has
happened many time before, but this time I get no hint of where in my C
functions the error might be. I give the output below. Can this be an R
bug? I suspect it has to do with repeated calls to 'vmmin' like this:
for (...){
vmax = vmaxget();
vmmin(*p, b, &Fmin,
bfun,
2006 Mar 24
0
using R's optimization routines from C
Dear all,
I have been trying to use R's optimization routines from C and I have some
questions. Specifically, I am testing the usage of nmmin which performs
Nelder-Mead optimization in order to learn how to do the above exercise.
I understand from the notes in Chapter 5 that the declaration for both optimfn
as well as nmmin are included in the header file R_ext/Applic.h so I have
included
2012 Oct 28
0
lbfgsb from C
Hi,
I wanted to use R's lbfgsb method for minimization from C. Unfortunately,
my toy examples always crashes (segmentation fault). What's wrong with it?
double eval(int n, double* par, void *ex) {
double result = 0;
for (int i=0; i<n; ++i) {
result += par[i]*par[i];
}
printf("result=%.2f\n", result);
return result;
}
void grad(int n, double *par, double *gr,
2012 Jun 08
0
Working with optim in C
I've searched to find examples of how to work with the C versions of
optim.
I've separated out the function just to test on it alone, and currently I'm
attempting to use fmmin as follows:
!~~CODE ~~!
double optimfn(int n, double *par, void *ex) {
double * lambda = (double*)malloc(sizeof(double)*n);
double sum = 0;
for(int i =0; i < n; i++) { lambda[i] =
2007 Oct 23
0
API for optimization with Simulated annealing
Dear list,
I was trying to use the R API for optimization method "Simulated annealing"
void samin(int n, double *x, double *Fmin, optimfn fn, int maxit,
int tmax, double temp, int trace, void *ex);
but I encountered the following problem:
The implementation of the function samin (as seen in src/main/optim.c)
passes its void * argument "ex" into the function
2005 Apr 20
2
how to get code of a .Internal() function?
Hello,
I'm working with the function optim() from stats
package,
and inside this function is called the function
.Internal(optim(....)) and I want to get the code of
this function which would help me to understand why
the Nelder-Mead algorithm doesn't converge with my
data.
I'm working under Windows XP.
Could you reply to this adress because I don't belong
to the mailing list
2005 Mar 09
1
nnet abstol
Hi,
I am using nnet to learn transfer functions. For each transfer function I can estimate the best possible Mean Squared Error (MSE). So, rather than trying to grind the MSE to 0, I would like to use abstol to stop training once the best MSE is reached.
Can anyone confirm that the abstol parameter in the nnet function is the MSE, or is it the Sum-of-Squares (SSE)?
Best regards,
Sam.
2005 Apr 13
0
abstol in nnet
Hello All,
I would like to know what fit criterion (abstol arg)
is in nnet. Is it the threshold for the difference btw
the max output and target values?
Is the value at each iteration also the difference btw
max of output and target values over all output units
(case of multiple classes)?
How could value displayed at each iteration be related
to SSE and abstol be related to threshold SSE,
2009 Nov 02
2
a prolem with constrOptim
Hi,
I apologize for the long message but the problem I encountered can't be stated in a few lines.
I am having some problems with the function constrOptim. My goal is to maximize the likelihood of product of K multinomials, each with four catagories under linear constraints on the parameter values. I have found that the function does not work for many data configurations.
#The likelihood
2009 May 27
1
Constrained fits: y~a+b*x-c*x^2, with a,b,c >=0
I wonder whether R has methods for constrained fitting of linear models.
I am trying fm<-lm(y~x+I(x^2), data=dat) which most of the time gives
indeed the coefficients of an inverted parabola. I know in advance that
it has to be an inverted parabola with the maximum constrained to
positive (or zero) values of x.
The help pages for lm do not contain any info on constrained fitting.
Does anyone
2009 Mar 25
2
Listing of LAPACK error codes
Professor Ripley commented on LAPACK error codes:
https://stat.ethz.ch/pipermail/r-help/2007-March/127702.html and says
"Internal LAPACK errors are usually problems with arithmetic accuracy,
and as such are compiler- and CPU-specific."
Is there a listing for the error codes from Lapack routine 'dsyevr'?
Especially I am interested about the meaning and handling of error codes 1
2005 Dec 17
2
nlme problems
I'm maximising a reasonably complex function using nlme (version
3.1-65, have also tried 3.1-66) and am having trouble with fixed
parameter estimates slightly away from the maximum of the log
likelihood. I have profiled the log likelihood and it is a parabola
but with sum dips. Interestingly changing the parameterisation moves
the dips around slightly. Unfortunately the PNLS step is
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 =
2012 Jan 05
2
difference of the multinomial logistic regression results between multinom() function in R and SPSS
Dear all,
I have found some difference of the results between multinom() function in
R and multinomial logistic regression in SPSS software.
The input data, model and parameters are below:
choles <- c(94, 158, 133, 164, 162, 182, 140, 157, 146, 182);
sbp <- c(105, 121, 128, 149, 132, 103, 97, 128, 114, 129);
case <- c(1, 3, 3, 2, 1, 2, 3, 1, 2, 2);
result <- multinom(case ~ choles
2001 Sep 30
2
non linear models
Dear Members of the Help List,
Honestly, I feel a little bit stupid - I would like to do something rather
simple: fit a non linear model to existing data, to be more precise I wanted
to start with simple higher order polynomials.
Unfortunately, I do not quite understand the examples in the helpfiles for
the nlm, nls and nlsModel commands.
Could anyone please provide a simple example to get me
2004 Oct 18
1
nnet learning
Hi,
I am trying to make a neural network learning a "noisy sine wave".
Suppose I generate my data like so..
x <- seq(-2*pi, 2*pi, length=500)
y <- sin(x) + rnorm(500, sd=sqrt(0.075))
I then train the neural net on the first 400 points using
c <- nnet(as.matrix(x[1:400]),as.matrix(y[1:400]), size=3, maxit=10000,
abstol=0.075, decay=0.007)
Inspecting the fit of the training