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

Description Usage Arguments Details Value Examples

View source: R/genscore.R

Description

Estimate K and η using elts from get_elts() given one λ_K (and λ_η if non-profiled non-centered) and applying warm-start with strong screening rules.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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 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 K.

lambda2

A number, the penalty parameter for η. 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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 April 28, 2020, 1:06 a.m.