get_results: Estimate K and eta using elts from 'get_elts()' given one...

View source: R/genscore.R

get_resultsR Documentation

Estimate \mathbf{K} and \boldsymbol{\eta} using elts from get_elts() given one \lambda_{\mathbf{K}} (and \lambda_{\boldsymbol{\eta}} if non-profiled non-centered) and applying warm-start with strong screening rules.

Description

Estimate \mathbf{K} and \boldsymbol{\eta} using elts from get_elts() given one \lambda_{\mathbf{K}} (and \lambda_{\boldsymbol{\eta}} if non-profiled non-centered) and applying warm-start with strong screening rules.

Usage

get_results(
  elts,
  symmetric,
  lambda1,
  lambda2 = 0,
  tol = 1e-06,
  maxit = 10000,
  previous_res = NULL,
  is_refit = FALSE
)

Arguments

elts

A list, elements necessary for calculations returned by get_elts().

symmetric

A string. If equals "symmetric", estimates the minimizer \mathbf{K} over all symmetric matrices; if "and" or "or", use the "and"/"or" rule to get the support.

lambda1

A number, the penalty parameter for \mathbf{K}.

lambda2

A number, the penalty parameter for \boldsymbol{\eta}. Default to 0. Cannot be Inf if non-profiled non-centered.

tol

Optional. A number, the tolerance parameter.

maxit

Optional. A positive integer, the maximum number of iterations.

previous_res

Optional. A list or NULL, the returned list by this function run previously with another lambda value.

is_refit

A boolean, in the refit mode for BIC estimation if TRUE. If TRUE, lambda1, previous_lambda1 and lambda2 are all set to 0, and estimation is restricted to entries in exclude that are 0.

Details

If elts$domain_type == "simplex", symmetric != "symmetric" or elts$centered == FALSE && elts$profiled_if_noncenter are currently not supported. If elts$domain_type == "simplex" and elts$setting contains substring "sum0", it is assumed that the column and row sums of K are all 0 and estimation will be done by profiling out the diagonal entries.

Value

converged

A boolean indicating convergence.

crit

A number, the final penalized loss.

edges

A vector of the indices of entries in the K estimate that are non-zero.

eta

A p-vector, the eta estimate. Returned only if elts$centered == FALSE.

eta_support

A vector of the indices of entries in the eta estimate that are non-zero. Returned only if elts$centered == FALSE && elts$profiled_if_noncenter == TRUE.

iters

An integer, number of iterations run.

K

A p*p matrix, the K estimate.

n

An integer, the number of samples.

p

An integer, the dimension.

is_refit, lambda1, maxit, previous_lambda1, symmetric, tol

Same as in the input.

lambda2

Same as in the input, and returned only if elts$centered == FALSE and
elts$profiled_if_noncenter == FALSE.

Examples

# Examples are shown for Gaussian truncated to R+^p only. For other distributions
#   on other types of domains, please refer to \code{gen()} or \code{get_elts()}, as the
#   way to call this function (\code{get_results()}) is exactly the same in those cases.
n <- 50
p <- 30
domain <- make_domain("R+", p=p)
mu <- rep(0, p)
K <- diag(p)
x <- tmvtnorm::rtmvnorm(n, mean = mu, sigma = solve(K),
       lower = rep(0, p), upper = rep(Inf, p), algorithm = "gibbs",
       burn.in.samples = 100, thinning = 10)

h_hp <- get_h_hp("min_pow", 1, 3)
dm <- 1 + (1-1/(1+4*exp(1)*max(6*log(p)/n, sqrt(6*log(p)/n))))
elts_gauss_np <- get_elts(h_hp, x, setting="gaussian", domain=domain,
                centered=FALSE, profiled=FALSE, scale="norm", diag=dm)
test_nc_np <- get_results(elts_gauss_np, symmetric="symmetric", lambda1=0.35,
                lambda2=2, previous_res=NULL, is_refit=FALSE)
test_nc_np2 <- get_results(elts_gauss_np, symmetric="and", lambda1=0.25,
                 lambda2=2, previous_res=test_nc_np, is_refit=FALSE)

elts_gauss_p <- get_elts(h_hp, x, setting="gaussian", domain=domain,
               centered=FALSE, profiled=TRUE, scale="norm", diag=dm)
test_nc_p <- get_results(elts_gauss_p, symmetric="symmetric",
               lambda1=0.35, lambda2=NULL, previous_res=NULL, is_refit=FALSE)

elts_gauss_c <- get_elts(h_hp, x, setting="gaussian", domain=domain,
               centered=TRUE, scale="norm", diag=dm)
test_c <- get_results(elts_gauss_c, symmetric="or", lambda1=0.35,
               lambda2=NULL, previous_res=NULL, is_refit=FALSE)


genscore documentation built on May 29, 2024, 9 a.m.