#' Parameters Assuming Stochastic Regressors
#' as a Function of the Covariance Matrix
#'
#' @details
#' # Dependencies
#' * [rmvn_chol()] (test)
#'
#' @author Ivan Jacob Agaloos Pesigan
#'
#' @param x Numeric matrix.
#' Covariance matrix
#' \eqn{\boldsymbol{\Sigma}}
#' of
#' \eqn{\{y, x_1, \cdots, x_p \}^{\prime}}.
#'
#' @returns A numeric vector.
#'
#' @export
#' @family Structure of Regression Functions
#' @keywords strRegression
theta_of_sigmacap <- function(x) {
stopifnot(
is.matrix(x)
)
k <- dim(x)[1]
p <- k - 1
stopifnot(
k == dim(x)[2],
x == t(x)
)
beta <- drop(
solve(
x[2:k, 2:k, drop = FALSE],
x[2:k, 1, drop = FALSE]
)
)
sigmacapx <- x[2:k, 2:k, drop = FALSE]
sigmaysq <- x[1, 1]
sigmasq <- drop(
sigmaysq - (
tcrossprod(beta, sigmacapx) %*% beta
)
)
output <- c(
beta,
sigmasq,
sigmacapx[lower.tri(sigmacapx, diag = TRUE)]
)
names(output) <- c(
paste0("beta", seq_len(p)),
"sigmasq",
vechnames(paste0("x", seq_len(p)))
)
return(output)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.