similar to: Trouble with optim

Displaying 20 results from an estimated 300 matches similar to: "Trouble with optim"

2011 Mar 12
3
betareg help
Dear R users, I'm trying to do betareg on my dataset. Dependent variable is not normally distributed and is proportion (of condom use (0,1)). But I'm having problems: gyl<-betareg(cond ~ alcoh + drug, data=results) Error in optim(par = start, fn = loglikfun, gr = gradfun, method = method, : initial value in 'vmmin' is not finite Why is R returning me error in optim()? What
2007 Jul 26
1
zeroinfl() or zicounts() error
I'm trying to fit a zero-inflated poisson model using zeroinfl() from the pscl library. It works fine for most models I try, but when I include either of 2 covariates, I get an error. When I include "PopulationDensity", I get this error: Error in solve.default (as.matrix(fit$hessian)) : system is computationally singular: reciprocal condition number = 1.91306e-34 When I
2010 Mar 03
1
Zero inflated negative binomial
Hi all, I am running the following model: > glm89.nb <- glm.nb(AvGUD ~ Year*Trt*Micro) where Year has 3 levels, Trt has 2 levels and Micro has 3 levels. However when I run it has a zero inflated negative binomial (as I have lots of zeros) I get the below error message: > Zinb <- zeroinfl(AvGUD ~ Year*Trt*Micro |1, data = AvGUD89, dist = "negbin") Error in optim(fn =
2009 Nov 29
1
Convergence problem with zeroinfl() and hurdle() when interaction term added
Hello, I have a data frame with 1425 observations, 539 of which are zeros. I am trying to fit the following ZINB: f3<-formula(Nbr_Abs~ Zone * Year + Source) ZINB2<-zeroinfl(f3, dist="negbin", link= "logit", data=TheData, offset=log(trans.area), trace=TRUE) Zone is a factor with 4 levels, Year a factor with 27 levels, and Source a factor with 3 levels. Nbr_Abs is counts
2008 Oct 02
1
In the OPTIM message....
Dear all When I used the method, L-BFGS-B, in OPTIM, I've got the following message. --------------------------------------------------------------------- $par [1] 0.176166426835580 $value [1] 1322.17600079332 $counts function gradient 8 8 $convergence [1] 0 $message [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" $hessian [,1] [1,]
2005 Sep 06
1
R: optim
hi all i dont understand the error message that is produced by the optim function. can anybody help??? ie: [[1]]$message [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" can anyone help? ########################################################################### SK.FIT(XDATA=a,XDATAname="a",PHI1=1,v=5,vlo=2,vhi=300,phi2lo=.01) [[1]] [[1]]$par [1] -0.01377906
2012 Mar 20
2
Constraint Linear regression
Hi there, I am trying to use linear regression to solve the following equation - y <- c(0.2525, 0.3448, 0.2358, 0.3696, 0.2708, 0.1667, 0.2941, 0.2333, 0.1500, 0.3077, 0.3462, 0.1667, 0.2500, 0.3214, 0.1364) x2 <- c(0.368, 0.537, 0.379, 0.472, 0.401, 0.361, 0.644, 0.444, 0.440, 0.676, 0.679, 0.622, 0.450, 0.379, 0.620) x1 <- 1-x2 # equation lmFit <- lm(y ~ x1 + x2) lmFit Call:
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
2009 Sep 30
1
Optim(...) estimate of stDev far too low
R-help, I'm just trying to find the ML (maximum likelihood) estimates of the mean and standard deviation of a set of observations: >xx=c(2.5,3.5,4,6,6.5,7.5) fn<-function(params,x=xx) { media<-params[1] st <-params[2] pdf=-sum(dnorm(log(xx),log(media),st,TRUE)) return(pdf) } optim(c(mu,stdev),fn,method="L-BFGS-B",lower=c(0.001, 0.001) ,upper = rep(Inf, 2),
2009 Sep 24
1
Maximum likelihood estimation of parameters make no biological sense
R-help, I'm trying to estimate some parameters using the Maximum Likehood method. The model describes fish growth using a sigmoidal-type of curve: fn_w <- function(params) { Winf <- params[1] k <- params[2] t0 <- params[3] b <- params[4] sigma <- params[5] what <- Winf * (1-exp(- k *(tt - t0)))^b
2007 Feb 16
1
optim() and resultant hessian
R users; A question about optimization within R. I've been using both optim() and nlminb() to estimate parameters and all seems to be working fine. For context (but without getting into specifics - sorry), I'm working with a problem that is known to have correlated parameters, and parameter estimation can be difficult. I have a question on optim() - I'm using
2007 Jan 03
1
optim
Hi! I'm trying to figure out how to use optim... I get some really strange results, so I guess I got something wrong. I defined the following function which should be minimized: errorFunction <- function(localShifts,globalShift,fileName,experimentalPI,lambda) { lambda <- 1/sqrt(147) # error <- abs(errHuber(localShifts,globalShift, #
2002 Jul 30
1
Optim() returns wrong maximum
Dear R-devel During the last half a year I have several times encountered the following problem with optim() when using method= "L-BFGS-B". The function return a value which is clearly not the maximum (seen from printing the value each time the function is called). Some output is shown below. A few things I have observed (as I remember it): a. The problem seems to occur when the
2010 Nov 03
3
optim works on command-line but not inside a function
Dear all, I am trying to optimize a logistic function using optim, inside the following functions: #Estimating a and b from thetas and outcomes by ML IRT.estimate.abFromThetaX <- function(t, X, inits, lw=c(-Inf,-Inf), up=rep(Inf,2)){ optRes <- optim(inits, method="L-BFGS-B", fn=IRT.llZetaLambdaCorrNan, gr=IRT.gradZL, lower=lw, upper=up, t=t, X=X)
2023 Aug 19
1
Determining Starting Values for Model Parameters in Nonlinear Regression
Thank you so much Dr. Nash, I truly appreciate your kind and valuable contribution. Cheers, Paul El El s?b, 19 de ago. de 2023 a la(s) 3:35 p. m., J C Nash < profjcnash at gmail.com> escribi?: > Why bother. nlsr can find a solution from very crude start. > > Mixture <- c(17, 14, 5, 1, 11, 2, 16, 7, 19, 23, 20, 6, 13, 21, 3, 18, 15, > 26, 8, 22) > x1 <- c(69.98, 72.5,
2023 Aug 20
1
Determining Starting Values for Model Parameters in Nonlinear Regression
The cautions people have given about starting values are worth heeding. That nlxb() does well in many cases is useful, but not foolproof. And John Fox has shown that the problem can be tackled very simply too. Best, JN On 2023-08-19 18:42, Paul Bernal wrote: > Thank you so much Dr. Nash, I truly appreciate your kind and valuable contribution. > > Cheers, > Paul > > El El
2023 Aug 19
1
Determining Starting Values for Model Parameters in Nonlinear Regression
Dear friends, Hope you are all doing well and having a great weekend. I have data that was collected on specific gravity and spectrophotometer analysis for 26 mixtures of NG (nitroglycerine), TA (triacetin), and 2 NDPA (2 - nitrodiphenylamine). In the dataset, x1 = %NG, x2 = %TA, and x3 = %2 NDPA. The response variable is the specific gravity, and the rest of the variables are the predictors.
2004 Aug 11
0
always NaN after some running in R, but all fine in S-plus
Hello, S-plus and R helpers,(sorry for cross-post) I wrote some simple C code for one likelihood to be optimized (using optim(MASS)). I use same function, same data, same starting points and same DLL in R and S-plus for comparison. (I compiled it with 'Rcmd SHLIB likelihood.c' and the header files of it include only R.h and math.h). While it works quite fine in S-plus, it forever returns
2008 Dec 03
1
nlminb: names of parameter vector not passed to objective function
Dear R developers, I tried to use nlminb instead of optim for a current problem (fitting parameters of a differential equation model). The PORT algorithm converged much better than any of optim's methods and the identified parameters are plausible. However, it took me a while before spotting the reason of a technical problem that nlminb, in contrast to optim, does not pass names of the
2013 May 29
0
"Unable to optimize" error returned in factanal using R-3.0.1, Windows 64 bit, and OpenBLAS
Hello, I have been trying for weeks to compile a 64-bit Rblas. I started with ATLAS where I have had success in the past, but 64 bit was not behaving, and as each compilation takes between 9 and 12 hours, "test, check, and revise" was not going to be really viable. I therefore switched to OpenBLas (OPBL). I was successful in compiling R-3.0.1 and an OPBL-based BLAS for Windows 64bit