Description Usage Arguments Value Author(s) Examples
View source: R/JGL_surfaceplot.R
Compute the criterioin defined by aicfun
on ncand l1 x ncand l2 pairs of l1 and l2. Optionally does a 3d plot of the criterion on the l1 and l2 values
1 | JGL_AIC_surfaceplot(dat, splt, l1min = 0, l1max = 1, l2min = 0, l2max = 1, ncand = 20, aicfun = AIC_jgl, plot = TRUE, ncores = 1, ...)
|
dat |
A dataset that includes the variables on which the gaussian graphical models should be computed, plus an additional factor |
splt |
Character string. The name of the variable in dat that defines different classes |
l1min |
Numeric. Minimum value of the lasso parameter lambda1 |
l1max |
Numeric. Maximum value of the lasso parameter lambda1 |
l2min |
Numeric. Minimum value of the lasso parameter lambda2 |
l2max |
Numeric. Maximum value of the lasso parameter lambda2 |
ncand |
Integer. number of values for lambda 1 and for lambda 2 |
aicfun |
|
plot |
if |
ncores |
Number of cores to use. The function is optimized for parallel computing in Windows, parallel computing may not work on other systems. |
... |
Additional parameters for |
A dataframe with the following objects
lambda1 |
Values of lambda 1 considered |
lambda2 |
Values of lambda 2 considered |
aic |
The AIC or other criterion for each pair of lambda 1 and lambda 2 values |
Giulio Costantini
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 | ## Not run:
# # a toy example
N <- 1000 # sample size
sigma1 <- matrix(c(1, .5, 0, 0,
.5, 1, .2, 0,
0, .2, 1, 0,
0, 0, 0, 1), ncol = 4)
sigma2 <- matrix(c(1, .5, .4, .4,
.5, 1, .2, 0,
.4, .2, 1, 0,
.4, 0, 0, 1), ncol = 4)
dat <- list()
dat[[1]] <- MASS::mvrnorm(n = N, mu = rep(0, ncol(sigma1)), Sigma = sigma1)
dat[[2]] <- MASS::mvrnorm(n = N, mu = rep(0, ncol(sigma2)), Sigma = sigma2)
lapply(dat, function(x) corpcor::cor2pcor(cor(x)))
dat <- data.frame(rbind(dat[[1]], dat[[2]]))
dat$splt <- c(rep(1, N), rep(2, N))
aics <- JGL_AIC_surfaceplot(dat, splt = "splt", l1max = .01, l2max = .01, ncand = 10, ncores = 7, plot = TRUE)
scatter3d(aic ~ lambda1 + lambda2, data = aics, fit = "smooth", surface = FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.