Ah..constrOptim is for linear inequality constraints. your ci is a  
matrix. it should be a vector.


Nikhil



On Apr 29, 2010, at 3:14 AM, Cz³owiek Kuba wrote:

> Hi,
>
> You are right, my intention was to return a set of values and to  
> minimize them all in a multicriteria optimization problem.
>
> The interesting thing is that when I actually used scalar return of  
> this function, by minimizing sum of squares in this form:
>
> --------------------
> fr <- function(z) {
> t(z%*%matrix(c(2,5,6), 3,1)-matrix(c(5,4,2), 3,1))%*%(z%* 
> %matrix(c(2,5,6), 3,1)-matrix(c(5,4,2), 3,1))
> }
> constrOptim((matrix(c(0,0,0,0,0,0,0,0,0),3,3)), fr)
> or
> nlm(fr, matrix(c(0,0,0,0,0,0,0,0,0),3,3))
> ----------------------
> the function also returned non-comformable error.
> Kind regards
> Jacob
>
>
>
> 2010/4/29 Nikhil Kaza <nikhil.l...@gmail.com>
>
> fr does not return a scalar.
>
>
> Nikhil
>
>
>
> On Apr 28, 2010, at 3:35 AM, Cz³owiek Kuba wrote:
>
> 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 probability (aij in <0;1>). I tried to
> estimate A by using constrOptim the following way, but apparently it  
> won't
> work on matrices.
>
> fr <- function(x) {
> x%*%matrix(c(2,5,6), 3,1)-matrix(c(5,4,2), 3,1)
> x%*%matrix(c(6,2,3), 3,1)-matrix(c(1,1,1), 3,1)
> x%*%matrix(c(6,1,2), 3,1)-matrix(c(3,4,1), 3,1)
> }
> constrOptim(matrix(c(0.5,0.4,0.1,0.2,0.3,0.5,0.5,0.2,0.3),3,3), fr,  
> NULL,
> ui=matrix(c(1,0,0,0,1,0,0,0,1),3,3), ci=matrix(c(-.00001
> ,-.00001,-.00001,-.00001,-.00001,-.00001,-.00001,-.00001,-.00001), 
> 3,3))
>
> It produces the following error:
> "Error in ui %*% theta : non-conformable arguments"
>
> Kind regards and thanks for help
> Jacob
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to