search for: reltol

Displaying 20 results from an estimated 33 matches for "reltol".

2012 Nov 05
1
relative convergence in 'optim'
Dear list, I have a question related to the correct interpretation of the relative convergence criterion used by 'optim'. In the help of the function is it written that: "reltol:Relative convergence tolerance. The algorithm stops if it is unable to reduce the value by a factor of reltol * (abs(val) + reltol) at a step." and I was wondering if the previous criterion is equivalent to: abs( val [iter] - val[iter-1] ) / val [iter-1] <= reltol * ( abs( val [iter] ) +...
2012 May 15
6
Curva dosis-respuesta
...c("y", "dose"), row.names = c(NA, -9L), class = "data.frame") # curva # install.packages(''drm'') require(drm, quietly = TRUE, warn.conflicts = FALSE) with(d, plot(dose, y, las = 1)) fit <- drm(y ~ dose, fct = LL.4(), control = drmc(maxIt = 100000, relTol = 1e-4), data = d) # Error in optim(startVec, opfct, hessian = TRUE, method = optMethod, control = list(maxit = maxIt, : # non-finite finite-difference value [4] # Error in drmOpt(opfct, opdfct1, startVecSc, optMethod, constrained, warnVal, : # Convergence failed He cambiado un poco los parame...
2012 Mar 29
1
how to increase speed for function?/time efficiency of below function
..._____________________________ sarima=function(data,p,d,q,P=0,D=0,Q=0,S=-1,tol=.001){ n=length(data) constant=1:n xmean=matrix(1,n,1) if (d>0 & D>0) fitit=arima(data, order=c(p,d,q), seasonal=list(order=c(P,D,Q), period=S), optim.control=list(trace=1,REPORT=1,reltol=tol)) if (d>0 & D==0) fitit=arima(data, order=c(p,d,q), seasonal=list(order=c(P,D,Q), period=S), xreg=constant,include.mean=F, optim.control=list(trace=1,REPORT=1,reltol=tol)) if (d==0 & D==0) fitit=arima(data, order=c(p,d,q), seasonal=list(order=c(P,D,Q), perio...
2009 Dec 18
1
Numerical Integration
...nction(x) { print(x) if(x<fx[1]) return(0) if(x>=fx[1] && x<fx[2]) return((x-fx[1])/(fx[2]-fx[1])) if(x>fx[2] && x<=fx[3]) return(1) if(x>fx[3] && x<=fx[4]) return((x-fx[4])/(fx[3]-fx[4])) if(x>fx[4]) return(0) } fx<-data[i,j,] reltol<-1e-07 integrate(Vectorize(integrand),0,1,rel.tol=reltol,subdivisions=200)$value It works for most cases, but then, I tried for the triangle fx<-[0.3,0.5,0.5,0.6] and the following error was presented: > integrate(Vectorize(integrand),0,1,rel.tol=reltol,subdivisions=200) [1] 0.5 [1] 0.01...
2013 May 15
1
Problem with convergence in optim
Hello to all, I have been using an optim with the following call: optim(param_ini,fun_errores2,Precio_mercado=Precio,anos_pagosE2=anos_pagos,control=list(maxit=10000,reltol=1e-16)) depending on the intial values I'm getting the same solution but once I get the convergence message=10 (no convergence) and for the others I get convergence message = 0 Solution1: $par beta1 beta2 beta3 lambda beta1 0.06537061 0.001474821 -0.0759236 0.5 $e2...
2009 Nov 02
2
a prolem with constrOptim
...= numeric(3*K) for(i in 1:K) {theta.0[(1+3*(i-1)):(3*i)] = rep(1/10,3)+i/100} # data1 gives an error but data2 does not! constrOptim(theta=theta.0, f=likelihood, grad=score, ui=RR,ci=zeros, data = data1, method="BFGS", control=list(fnscale=-1,abstol=1e-16,reltol=1e-16))$par constrOptim(theta=theta.0, f=likelihood, grad=score, ui=RR,ci=zeros, data = data2, method="BFGS", control=list(fnscale=-1,abstol=1e-16,reltol=1e-16))$par # If you want to further check run the simulation below. K = 3 N = rep(20,K) p = c(1/10...
2011 Sep 09
2
Different results with arima in R 2.12.2 and R 2.11.1
Hello , I have estimated the following model, a sarima: p=9 d=1 q=2 P=0 D=1 Q=1 S=12 In R 2.12.2 Call: arima(x = xdata, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = S), optim.control = list(reltol = tol)) Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 0.3152 0.8762 -0.4413 0.0152 0.1500 0.0001 -0.0413 -0.1811 0.0646 s.e. 0.0865 0.0885 0.1141 0.1181 0.1196 0.1220 0.1120 0.0908 0.0865 ma1 ma2 sma1 -0...
2007 Oct 13
1
R API - optim
...nDemo", "--gui=none", "--silent"}; const int argc = 3; double initial[1] = {1.5}; double result[1]; double value; int convergenceCode; /* * The following values are based on the help * page for optim. */ const double abstol = 1e-16; const double reltol = 1e-8; const double alpha = 1.0; /* reflection factor */ const double beta = 0.5; /* contraction factor */ const double gamm = 2.0; /* expansion factor */ const int trace = 0; /* tracing on */ int fncount; const int maxit = 10000; Rf_initEmbeddedR(argc, argv); nmmin(1, initial, re...
2012 Jan 05
2
difference of the multinomial logistic regression results between multinom() function in R and SPSS
...ware. 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 + sbp + choles:sbp, abstol=1.0e-20, reltol=1.0e-20, MaxNWts=10000); However, the estimated coeffcients and standard errors of the coefficeints are different from the SPSS. For instance, the estimated coefficients of the variable "choles" are 0.1946555 and 0.6244513 from the above result, but the SPSS result are 0.213120 and 0....
2005 Apr 13
2
multinom and contrasts
Hi, I found that using different contrasts (e.g. contr.helmert vs. contr.treatment) will generate different fitted probabilities from multinomial logistic regression using multinom(); while the fitted probabilities from binary logistic regression seem to be the same. Why is that? and for multinomial logisitc regression, what contrast should be used? I guess it's helmert? here is an example
2012 Jan 19
0
state multi-state modeling using hidden markov routine in the msm package
..., 0), c(0.01, 0, 0.01,0), c(0, 0.1, 0, 0), c(0, 0, 0, 0)) 2. the model: msm_covariates_sexandage <- msm(state ~ duration, subject = SerialNo, data = Data, qmatrix = twoway4.q, ematrix = ematrix,death = 4, obstrue = firstobs, covariates = ~ sex + age, method = "BFGS", control = list(reltol = 1e-10, fnscale = 50000, trace=1,REPORT=1)) msm stops after only 100 iterations and fails to compute the Hessian (See the output below). Why is it stopping at 100 only iterations yet i have specified reltol = 1e-10? One additional information is that when i exclude age, the model converges with...
2006 Apr 13
1
bus error on calling nmmin
...ude <R_ext/Applic.h> #include <stdio.h> double parabola(int n, double *par, void *ex) { double xm = par[0] - 1; return xm * xm + 13; } int main() { double initial[1] = {1.5}; double result[1]; double value; int convergenceCode; const double abstol = 1e-16; const double reltol = 1e-8; const double alpha = 1.0; /* reflection factor */ const double beta = 0.5; /* contraction factor */ const double gamm = 2.0; /* expansion factor */ const int trace = 4; /* tracing on */ int fncount; const int maxit = 10000; nmmin(1, initial, result, &value, parabola, &amp...
2008 Oct 22
1
optim bug/help?
...ure I am missing something but why isn't 1,1 a better answer? If I plug 1,1 in the function it seems that the function is zero. Whereas the answer given gives a function result of 8.82e-8. This was after 195 calls to the function (as reported by optim). The documentation indicates that the 'reltol' is about 1e-8. Is this the limit that I am bumping up against? Kevin
2011 Sep 12
1
Difference in function arima estimation between 2.11.1 and R 2.12.2
Hello , I have estimated the following model, a sarima: p=9 d=1 q=2 P=0 D=1 Q=1 S=12 In R 2.12.2 Call: arima(x = xdata, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = S), optim.control = list(reltol = tol)) Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 0.3152 0.8762 -0.4413 0.0152 0.1500 0.0001 -0.0413 -0.1811 0.0646 s.e. 0.0865 0.0885 0.1141 0.1181 0.1196 0.1220 0.1120 0.0908 0.0865 ma1 ma2 sma1 -0...
2008 Dec 11
1
Error fitting ZIP with zeroinfl()
I am attempting to fit a full zero-inflated Poisson model then use backward elimination to arrive at the best-fitting model. When I try to fit the model with zeroinfl() I get this error: Error in while (abs((ll_old - ll_new)/ll_old) > control$reltol) { : missing value where TRUE/FALSE needed Any suggestions? Thanks for your help! Paige Barlow MS Student Virginia Tech Dept Fish and Wildlife
2010 May 21
0
weighted regression using drm() in drc package
...package, and nls(), found very different results derived from drm() vs. nls() using "weights=" argument. d1<-read.table("d1.txt",sep='\t',header=T,row.names=1) drm(y~x,weights=1/exp((-1.8286)+0.05481*y-0.000405225*(y-48.34177)^2),data = d1,fct = LL.4(),control=drmc(relTol=1e-12)) b:(Intercept) c:(Intercept) d:(Intercept) e:(Intercept) -1.5859 0.7823 47.3591 38.7717 nls(y~c+(d-c)/(1+(x/e)^b),weights=1/exp((-1.8286)+0.05481*y-0.000405225*(y-48.34177)^2),data=d1, start=list(b=-1, c =0, d=100, e=150)) b c d e...
2006 Jun 12
1
r's optim vs. matlab's fminsearch
...***Matlab's fminsearch defaults*** MaxFunEvals: '200*numberofvariables' MaxIter: '200*numberofvariables' TolFun: 1.0000e-004 #Termination tolerance on the function value. TolX: 1.0000e-004 #Termination tolerance on x. ***R's optim defaults (for Nelder-Mead)*** maxit=500 reltol=1e-8 alpha=1.0 #Reflection beta=.5 #Contraction gamma=2.0 #Expansion Anthony J. Bishara Post-Doctoral Fellow Department of Psychological & Brain Sciences Indiana University 1101 E. Tenth St. Bloomington, IN 47405 (812)856-4678
2005 Oct 11
2
Sometimes having problems finding a minimum using optim(), optimize(), and nlm() (while searching for noncentral F parameters)
...value of 'F.value'. } # Use the quantile from a central F distribution as a minimum. LL.0 <- qf(p=alpha.lower, df1=df.1, df2=df.2) optim(par=LL.0, fn=Low.Lim.NC.F, method="L-BFGS-B", # Others return the same result usually. lower=LL.0, upper = Inf, control = list(maxit=maxit, reltol=1e-10), hessian = FALSE, alpha.lower=alpha.lower, F.value=F.value, df.1=df.1, df.2=df.2) # Try to accomplish the same task with a different R function. optimize(f=Low.Lim.NC.F, lower=LL.0, upper=50, maximum=FALSE, tol=tol, alpha.lower=alpha.lower, F.value=F.value, df.1=df.1, df.2=df.2) # Try t...
2007 Feb 02
1
Snow Package and R: Exported Variable Problem
...nd S is a constant defined above as 500. Using print statements (since snow, or R for that matter, has next to no ability to debug) I found that the error cropped up in this statement: theta6 = optim(c(0,0,0,0,0,0,.2), loglikelihood, scrore6, method = "CG", control=list(fnscale=-1,reltol=1e-8,maxit=2000))$par Both the functions loglikelelihood and score6 use x1, but I know that it is getting exported to the node correctly since it gets assigned earlier in the simulation: x1 = rep(0,n1) The error I stated above happens fo every itteration of the simulation (499 times) and I...
2008 Oct 03
1
Memory crash
...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, bfun_gr, *maxit, *trace, mask, abstol, reltol, nREPORT, ext, &fncount, &grcount, &fail); vmaxset(vmax); ... } but I am only guessing. Any suggestions? Ubuntu 8.04, R-2.7.2. G?ran ------------------------------------------------------------------- > glmmboot(y ~ x, cluster = cluster, da...