I am creating optimization algorithm where I need to plug initial value of A which is a lower triangular matrix with positive diagonal. My first question is how to derive a random lower triangular matrix with positive diagonal as an initial value matrix in r? And is it good idea to choose random matrix? if not what are the ways to do a better initial guess for this type of matrix?
I can imagine there are much better solutions based on your specific applications, but we can set the diagonal to half-Normal (i.e. |e|
where e
~ N(0,1)) and set the lower-triangular off-diagonal elements to standard Normal values. ...
n <- 10
M <- diag(abs(rnorm(n)))
M[lower.tri(M, diag = FALSE)] <- rnorm(n*(n-1)/2)