Displaying 20 results from an estimated 7000 matches similar to: "Specifying ui and ci such that ui %*% theta - ci >= 0"
2009 Jun 16
1
Constrained Optimization, a full example
After a few days of work, I think I nearly have it.
Unfortunately, theta is unchanged after I run this (as a script from a
file). I thought that theta would contain the fitted parameters.
The goal here is to find the least squares fit according to the function
defined as "rss" subject to the constraints defined as ui and ci.
I defined ui and ci to (hopefully) force par2 and par3
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 Nov 18
1
bug in '...' of constrOptim (PR#14071)
Dear all,
There appears to be a bug in how constrOptim handles ... arguments that
are suppose to be passed to optim, according to the documentation. This
means you can't get the hessian to be returned, for example (so this is
a real problem, and not just a question of mistaken documentation).
Looking at the code, it appears that a call to the user-defined f
includes the ..., when the ...
2003 Oct 29
1
constrOptim doesn´t send arguments to optim!(?)
Hi,
I think that there something wrong with the 'constrOptim' max/minimization
function because she doesn?t send extra arguments to 'optim' call.
Fact: When I use optim in a f(x,theta)-like function, everything goes ok.
But using constrOptim with the same function leads to error...
Proof: Make a small change in the 'Rosenbrock Banana function' (taken from
the Examples
2013 Sep 26
0
ConstrOptim Function (Related to Constraint Matrix/ui/ci error)
Hello All,
I am stuck in the following problem.
Cexpt=c(0,25,50,100,150,300,250,125,40)
t=c(0,0.2,0.4,0.6,1,4,8,12,24)
theta0= vector of 6 parms (My initial parameter)
A=Constraint matrix (hopefully 6*6)
B= Constraint vector of length 6)
Cfit=function(t,theta){
J(t)=function(theta,t)
Cfit=function(J(t),constant)
return(Cfit) }
loss=function(theta,t,Cexpt) {
2010 Jun 17
2
constrOptim( ): conflict between help page and code
There is a contradiction between what the help page says and what constrOptim actually
does with the constraints. The issue is what happens on the boundary.
The help page says
The feasible region is defined by ?ui %*% theta - ci >= 0?,
but the R code for constrOptim reads
if (any(ui %*% theta - ci <= 0))
stop("initial value not feasible")
The following example
2009 Jun 16
0
ui and ci explanatory documentation
Hi Livia and everyone,
Did you ever get a response on this question from last year (Jan 2008)?
I am also looking for more explanatory documentation on the
ui and ci parameters for the function constrOptim().
The examples provided in the R help and the full reference
manual are not working for me. Goodle and Nabble searches have not resulted
in any explanation
2004 Aug 09
4
linear constraint optim with bounds/reparametrization
Hello All,
I would like to optimize a (log-)likelihood function subject to a number of
linear constraints between parameters. These constraints are equality
constraints of the form A%*%theta=c, ie (1,1) %*% 0.8,0.2)^t = 1 meaning
that these parameters should sum to one. Moreover, there are bounds on the
individual parameters, in most cases that I am considering parameters are
bound between zero
2012 Dec 07
1
Error using constrOptim in constraint definition
Hello,
I'm trying to run constrOptim. It returns to me an error about the fact that constraints arguments (ui and ci) are non compatibles:
> optout= constrOptim(startparams, f=ImpulseSS, grad=grImpulse, ui=UI, ci=CI, data=gexp[k,], t=t)
Error in ui %*% theta : non-conformable arguments
I would like to point out that I can calculate that product in the command line:
> UI %*%
2004 Jul 14
2
constrOptim and function with additional parameters?
How can I use a function with some additional input parameters
in constrOptim? For example, something like
fr <- function(x,a) { ## Rosenbrock Banana function
x1 <- x[1]
x2 <- x[2]
a * (x2 - x1 * x1)^2 + (1 - x1)^2
}
where the optimum is to be found w.r.t. x. Calling
optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail
to provide the a=100 in the constrained case:
2009 Jun 16
2
Trouble with optim on a specific problem
Hello!
I am getting the following errors when running optim() [I tried optim() with
3 different methods as you can see]:
Error in optim(c(0.66, 0.999, 0.064), pe, NULL, method = "L-BFGS-B") :
objective function in optim evaluates to length 6 not 1
> out <- optim( c(0.66, 0.999, 0.064), pe, NULL, method = "Nelder-Mead")
Error in optim(c(0.66, 0.999, 0.064),
2013 Feb 09
1
Optimization Problem in R
Dear List,
I'm new in R. I'm trying to solve a simple constrained optimization
problem.
Essentially, let's say I have a matrix as in the object 'mm' inside the
function below. My objective function should have a matrix of parameters,
one parameter for each element 'mm' (4 in this case). The problem is to
select the value of the parameters to maximize the function
2009 Jun 03
1
Using constrOptim() function
I have a function myFunction(beta,x) where beta is a vector of coefficients
and x is a data frame (think of it as a matrix). I want to optimize the
function myFunction() by ONLY changing beta, i.e. x stays constant, with 4
constraints. I have the following code (with a separate source file for the
function):
rm(list=ls())
source('mySourceFile')
2009 May 26
2
Linear Regression with Constraints
Hi!
I am a bit new to R.
I am looking for the right function to use for a multiple regression problem
of the form:
y = c1 + x1 + (c2 * x2) - (c3 * x3)
Where c1, c2, and c3 are the desired regression coefficients that are
subject to the following constraints:
0.0 < c2 < 1.0, and
0.0 < c3 < 1.0
y, x1, x2, and x3 are observed data.
I have a total of 6 rows of data in a data set.
Is
2011 Dec 01
1
Estimation of AR(1) Model with Markov Switching
Dear R users,
I have been trying to obtain the MLE of the following model
state 0: y_t = 2 + 0.5 * y_{t-1} + e_t
state 1: y_t = 0.5 + 0.9 * y_{t-1} + e_t
where e_t ~ iidN(0,1)
transition probability between states is 0.2
I've generated some fake data and tried to estimate the parameters using the
constrOptim() function but I can't get sensible answers using it. I've tried
using
2011 Dec 21
1
constrOptim and further arguments
Dear List,
I have the code below, where I am using the constrained optimisation
package, 'constrOptim.nl' to find the values of two values, b0 and b1.
I have no problems when I enter further variable information DIRECTLY into
the functions, fn, and heq. In this instance I require fn to have -0.0075
appended to it, and in the case of heq, h[1] has -0.2.
library(alabama)
2004 Nov 05
1
Code/doc inconsistancy in constrOptim (PR#7346)
Code in constrOptim() (R-2.0.0, package stats):
if (any(ui %*% theta - ci <= 0))
stop("initial value not feasible")
but the help page tells us in Section "Details":
"The feasible region is defined by ui %*% theta - ci >= 0."
Uwe Ligges
--please do not edit the information below--
Version:
platform = i386-pc-mingw32
arch = i386
os =
2008 May 12
1
hessian in constrained optimization (constrOptim)
Dear helpers,
I am using the function "constrOptim" to estimate a model with ML with an
inequality constraint using the option method='Nelder-Mead'.
When I specify the option: hessian = TRUE I obtain the response:
Error in f(theta, ...) : unused argument(s) (hessian = TRUE)
I guess the function "constrOptim" does not allow this argument which, on
the other hand, is
2007 Sep 07
1
'initial value not feasible' in constrOptim
Dear friends.
I am using function
constrOptim(c(0.5,0.3,0.5), fit.error, fit.error.grr, ui=-1*ui,ci=-1*ci)
and I am confronted with error message "initial value not feasible"
I plug in the initial value of (0.5,0.3,0.5) to function fit.error and
fit.error.grr and have pretty reasonable result. I inequality "ui %*% theta
- ci >= 0" as suggested in the R manual and it is
2010 Apr 28
1
Problem with optimization (constrOptim)
Hello,
I have the following problem:
I have a set of n matrix equations in the form of :
[b1] = [A] * [b0]
[b2] = [A] * [b1]
etc.
vertical vectors [b0], [b1], ... are GIVEN. We try to estimate matrix A. As
there are many equations (more than cells in matrix A) the system has no
solutions.
A is transition matrix (stochastic matrix) or markov process, so the sum of
each row = 1 and each entry is