similar to: nlm() and optim()

Displaying 20 results from an estimated 1000 matches similar to: "nlm() and optim()"

2012 Jun 12
4
replacing NA for zero
Dear R users, I have a very basic query, but was unable to find a proper anwser. I have the following data.frame x y 2 0.12 3 0.25 4 0.11 6 0.16 7 0.20 and, due to further calculations, I need the data to be stored as x y 1 0 2 0.12 3 0.25 4 0.11 5 0 6 0.16 7 0.20 8 0 How do
2004 Oct 12
2
constrained optimization using nlm/optim?
I'm looking for an example of a simple R script that impliments a contrained nonlinear function using nlm or optim. I'm not exactly sure how to impliment the constraints within the objective function that is passed to nlm/optim. obj.func <- function( p ) { x(p) <- unconstrained obj function value if( constraint1 > something ) { obj.func <- x(p) } else {
2010 Feb 02
1
how to use optim() or nlm() to solve three nonlinear equations
Dear all, I just know how to solve an eaquation by using optim() or nlm(). But, now, I have three nonlinear equations, how could we use optim() or nlm() to solve  a system of nonlinear equations in R?  Thank you so much. Sincerely, Joe ___________________________________________________ 您的生活即時通 - 溝通、娛樂、生活、工作一次搞定! [[alternative HTML version deleted]]
2010 Oct 22
2
Error message in using nlm() and optim()
I am facing a problem when trying to maximize the likelihood function. I am actually estimating a dynamic switching regression model using simulated likelihood approach. The likelihood function is estimated using Simulations and is extremely complex. It comprises of 16 parameters ,q1, q2, q3,.......q16. While attempting to maximize the likelihood function, using the functions nlm() and optim(),
2008 Oct 13
0
optim and nlm error to estimate a matrix
Dear R users, I'm trying to estimate the matrix of regression parameters. I need to do it numerically, so I used optim and nls. I got the initial parameter estimates from least squares, and input them into those functions. But when I run the optim function, it stops in 30 seconds and shows 'convergence=1'. And if I use the nlm function, then it runs for a while, and finally stops
2003 Jan 23
2
Profile on optim/nlm
Greetings, Before I reinvent the wheel has anyone done a profile function for a fit using optim (or nlm)? (like the buggy profile.ms in S+) . It seems a bit tricky as the function to be minimised has to have arguments corresponding to the variables being fitted - which is one less than the function provided to optim()... I guess you can create another function on the fly somehow. Cheers,
2002 Apr 26
1
optim or nlm with matrices
Hi, I have the following hypothetical optimization problem: -det(t(x-A%*%x1)%*%(x-A%*%x1)) where A,x,x1 are matrices. A coefficients and x and x1 are variable matrices or vectors. I tried to apply optim and nlm functions but I kept receive the following massage: Error in A%*%x1 : non-conformable arguments. The massage appears even the -det() can be calculated and the dimensions are checked. here
2010 Jul 08
2
Using nlm or optim
Hello, I am trying to use nlm to estimate the parameters that minimize the following function: Predict<-function(M,c,z){ + v = c*M^z + return(v) + } M is a variable and c and z are parameters to be estimated. I then write the negative loglikelihood function assuming normal errors: nll<-function(M,V,c,z,s){ n<-length(Mean) logl<- -.5*n*log(2*pi) -.5*n*log(s) -
2008 Aug 05
1
optimize simultaneously two binomials inequalities using nlm( ) or optim( )
Dear R users, I?m trying to optimize simultaneously two binomials inequalities (used in acceptance sampling) which are nonlinear solution, so there is no simple direct solution. Please, let me explain shortly the the problem and the question as following. The objective is to obtain the smallest value of 'n' (sample size) satisfying both inequalities: (1-alpha) <= pbinom(c, n, p1)
2005 Oct 11
2
Sometimes having problems finding a minimum using optim(), optimize(), and nlm() (while searching for noncentral F parameters)
Hi everyone. I have a problem that I have been unable to determine either the best way to proceed and why the methods I'm trying to use sometimes fail. I'm using the pf() function in an optimization function to find a noncentrality parameter that leads to a specific value at a specified quantile. My goal is to have a general function that returns the noncentrality parameter that
2010 Jun 15
1
Error in nlm : non-finite value supplied by 'nlm'
Hello, I am trying to compute MLE for non-Gaussian AR(1). The error term follows a difference poisson distribution. This distribution has one parameter (vector[2]). So in total I want to estimate two parameters: the AR(1) paramter (vector[1]) and the distribution parameter. My function is the negative loglikelihood derived from a mixing operator. f=function(vector)
2008 Mar 19
0
Error en nlm(logdgenexpn, p = c(vmomest[[1]], vmomest[[2]]), x = x.genexp, : valor no finito provisto por 'nlm'
Dear useRs, I am analysing the behaviour of MLE for the two parameters of a kind of exponential distribution, leaving as initial values the estimators moments produced by the variation coefficient. I do using simulations, giving them an accountant, r. But running my codes remains a problem with the nlm function. To review details wearing On one of the lines put status
2003 Oct 24
1
first value from nlm (non-finite value supplied by nlm)
Dear expeRts, first of all I'd like to thank you for the quick help on my last which() problem. Here is another one I could not tackle: I have data on an absorption measurement which I want to fit with an voigt profile: fn.1 <- function(p){ for (i1 in ilong){ ff <- f[i1] ex[i1] <- exp(S*n*L*voigt(u,v,ff,p[1],p[2],p[3])[[1]]) } sum((t-ex)^2) } out <-
2005 Nov 02
1
model selection based on AICc
Dear members of the list, I'm fitting poisson regression models using stepAIC that appear to be overparametrized. I would like to know if there is the possibility of fitting models by steps but using the AICc instead of AIC. Best wishes German Lopez
2005 Nov 03
1
Help on model selection using AICc
Hi, I'm fitting poisson regression models to counts of birds in 1x1 km squares using several environmental variables as predictors. I do this in a stepwise way, using the stepAIC function. However the resulting models appear to be overparametrized, since too much variables were included. I would like to know if there is the possibility of fitting models by steps but using the AICc
2009 Feb 19
2
Source code for nlm()
Hi, Where can I find the source code for nlm()? I dowloaded the R2.8.1.tar.gz file and looked at all the .c and .f files, but couldn't find either nlm.c or nlm.f There is an nlm.r file, but that is not useful. Thanks for any help, Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging
2008 May 22
1
Computing Maximum Loglikelihood With "nlm" Problem
Hi, I tried to compute maximum likelihood under gamma distribution, using nlm function. The code is this: __BEGIN__ vsamples<- c(103.9, 88.5, 242.9, 206.6, 175.7, 164.4) mlogl <- function(alpha, x) { if (length(alpha) > 1) stop("alpha must be scalar") if (alpha <= 0) stop("alpha must be positive") return(- sum(dgamma(x, shape = alpha, log = TRUE)))
2012 Oct 19
2
likelihood function involving integration, error in nlm
Dear R users, I am trying to find the mle that involves integration. I am using the following code and get an error when I use the nlm function d<-matrix(c(1,1,0,0,0,0,0,0,2,1,0,0,1,1,0,1,2,2,1,0),nrow=10,ncol=2) h<-matrix(runif(20,0,1),10) integ<-matrix(c(0),nrow=10, ncol=2) ll<-function(p){ for (k in 1:2){ for(s in 1:10){ integrand<-function(x)
2008 Jun 03
1
nlm behaviour and error
Hi R-Gurus, I've been cutting along quite nicely with nlm, until I threw in the following condition in the function that nlm is minimising: if (((term*bexp) < 0.0001)) { #warning(term*bexp, "=term*bexp",psi,"=psi") theta<-2000 } Now when I run this function anywhere else, there is no problem, whether or the if's condition is met. When
2003 Sep 01
3
error message in nlm()
Hi all, I have been trying the nlm function but received an error message which reads: Error in nlm(intensities ~ f, c(epsilon.spec.start, epsilon.unspec.start, : invalid function value in 'nlm' optimizer The message is generated somewhere in the compiled part, apparently within the function static void fcn(int n, const double x[], double *f, function_info *state) where a jump