Skip to content

Commit

Permalink
Needed to determine p before defining gamma1, gamma2
Browse files Browse the repository at this point in the history
  • Loading branch information
louisdijkstra committed Feb 13, 2023
1 parent 2c49b9b commit 652d2c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions R/CVN.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ CVN <- function(data, W, lambda1 = 1:2, lambda2 = 1:2,
# Check correctness input -------------------------------
CVN::check_correctness_input(data, W, lambda1, lambda2, gamma1, gamma2, rho)

# Extract variables -------------------------------------
m <- length(data) # total number of graphs
p <- ncol(data[[1]]) # total number of variables
n_obs <- sapply(data, function(X) nrow(X)) # no. of observations per graph

# convert the lambda values to gamma values or the other way around
if (is.null(gamma1) && is.null(gamma2)) {
gamma1 <- 2*lambda1 / (m*p*(p-1))
Expand All @@ -147,11 +152,6 @@ CVN <- function(data, W, lambda1 = 1:2, lambda2 = 1:2,
lambda2 <- 1
}

# Extract variables -------------------------------------
m <- length(data) # total number of graphs
p <- ncol(data[[1]]) # total number of variables
n_obs <- sapply(data, function(X) nrow(X)) # no. of observations per graph

# Set-up cluster ---------------------------
if (n_cores > 1) {
cl <- makeCluster(n_cores)
Expand Down
2 changes: 1 addition & 1 deletion exec/quick-testrun.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ lambda1 = c(1, 2)
lambda2 = c(1, 2)

(cvn <- CVN::CVN(grid, W, warmstart = TRUE, eps = 1e-4, maxiter = 1000,
gamma1 = c(1,2), lambda1 = lambda1, lambda2 = lambda2, verbose = TRUE))
lambda1 = lambda1, lambda2 = lambda2, verbose = TRUE))

0 comments on commit 652d2c4

Please sign in to comment.