Description Usage Arguments Details Value Examples
The R implementation to get the elements necessary for calculations for the log-log setting (a=0, b=0) on the p-simplex.
1 2 3 4 5 6 7 8 9 10 | get_elts_loglog_simplex(
hdx,
hpdx,
x,
setting,
centered = TRUE,
profiled_if_noncenter = TRUE,
scale = "",
diagonal_multiplier = 1
)
|
hdx |
A matrix, h(x) applied to the distance of x from the boundary of the domain, should be of the same dimension as |
hpdx |
A matrix, h\'(x) applied to the distance of x from the boundary of the domain, should be of the same dimension as |
x |
An |
setting |
A string, log_log or log_log_sum0. If log_log_sum0, assumes that the true K has row and column sums 0 (see the A^d model), so only the off-diagonal entries will be estimated; the diagonal entries will be profiled out in the loss), so elements corresponding to the diagonals of K will be set to 0, and the loss will be rewritten in the off-diagonal entries only. |
centered |
A boolean, whether in the centered setting (assume μ=η=0) or not. Default to |
profiled_if_noncenter |
A boolean, whether in the profiled setting (λ_η=0) if non-centered. Parameter ignored if centered=TRUE. Default to |
scale |
A string indicating the scaling method. Returned without being checked or used in the function body. Default to |
diagonal_multiplier |
A number >= 1, the diagonal multiplier. |
For details on the returned values, please refer to get_elts_ab
or get_elts
.
A list that contains the elements necessary for estimation.
n |
The sample size. |
p |
The dimension. |
centered |
The centered setting or not. Same as input. |
scale |
The scaling method. Same as input. |
diagonal_multiplier |
The diagonal multiplier. Same as input. |
diagonals_with_multiplier |
A vector that contains the diagonal entries of Γ after applying the multiplier. |
setting |
The same setting as in the function argument. |
g_K |
The g vector. In the non-profiled non-centered setting, this is the g sub-vector corresponding to K. |
Gamma_K |
The Γ matrix with no diagonal multiplier. In the non-profiled non-centered setting, this is the Γ sub-matrix corresponding to K. |
g_eta |
Returned in the non-profiled non-centered setting. The g sub-vector corresponding to η. |
Gamma_K_eta |
Returned in the non-profiled non-centered setting. The Γ sub-matrix corresponding to interaction between K and η. |
Gamma_eta |
Returned in the non-profiled non-centered setting. The Γ sub-matrix corresponding to η. |
t1,t2 |
Returned in the profiled non-centered setting, where the η estimate can be retrieved from t1-t2*\hat{K} after appropriate resizing. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | n <- 50
p <- 30
eta <- rep(0, p)
K <- -cov_cons("band", p=p, spars=3, eig=1)
diag(K) <- diag(K) - rowSums(K) # So that rowSums(K) == colSums(K) == 0
eigen(K)$val[(p-1):p] # Make sure K has one 0 and p-1 positive eigenvalues
domain <- make_domain("simplex", p=p)
x <- gen(n, setting="log_log_sum0", abs=FALSE, eta=eta, K=K, domain=domain,
xinit=NULL, seed=2, burn_in=1000, thinning=100, verbose=FALSE)
h_hp <- get_h_hp("min_pow", 2, 3)
h_hp_dx <- h_of_dist(h_hp, x, domain) # h and h' applied to distance from x to boundary
elts_simplex_0 <- get_elts_loglog_simplex(h_hp_dx$hdx, h_hp_dx$hpdx, x,
setting="log_log", centered=FALSE, profiled=FALSE, scale="", diag=1.5)
# If want K to have row sums and column sums equal to 0; estimate off-diagonals only
elts_simplex_1 <- get_elts_loglog_simplex(h_hp_dx$hdx, h_hp_dx$hpdx, x,
setting="log_log_sum0", centered=FALSE, profiled=FALSE, scale="", diag=1.5)
# All entries corresponding to the diagonals of K should be 0:
max(abs(sapply(1:p, function(j){c(elts_simplex_1$Gamma_K[j, (j-1)*p+1:p],
elts_simplex_1$Gamma_K[, (j-1)*p+j])})))
max(abs(diag(elts_simplex_1$Gamma_K_eta)))
max(abs(diag(matrix(elts_simplex_1$g_K, nrow=p))))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.