On Oct 5, 2010, at 2:46 PM, QiJun Fung wrote:
Does any one know how to optimize the following function w.r.t to
beta? The difficulty here is the beta is a matrix not a vector. and f
is also a function of beta and an element of the objective function. I
just want to know for this complicated situation, is there any
packages or function to estimate matrix beta? All the packages I found
can only estimate the vector beta.
What is preventing you from passing a vector and then treating that
vector as a matrix within the function? Matrices in R are basically
folded vectors after all.
Thanks very much!
object.fn <- function(beta)
{
# Perhaps
b2 <- as.matrix(beta, nrow=3, ncol=3)
p <- M
f <-solve(diag(p)+w*Omega) %*% t(data.hist) %*% b2/
(norm(solve(diag(p)+w*Omega)%*%t(data.hist),"F"))
# return
sum(diag( (data.hist-b2 %*% t(f) ) %*% t(data.hist-b2 %*%
t(f) ) ) )+
w*t(b2) %*% b2 %*% t(f) %*% Omega %*% f
}
(I am taking as implied that the this will return a scalar or an
object that can be properly minimized.)
--
David Winsemius, MD
West Hartford, CT
______________________________________________
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.