This package gives GGFL estimates via coordinate descent algorithm.
cite this package of the latest version:
Ohishi, M. (2024).
GGFL: Coordinate optimization for GGFL.
R package version 0.4.0.
https://github.com/ohishim/GGFL
information:
- (2024/08/14) attention ! There is a mistake in the v0.3.0 and v0.3.1. The mistake has been corrected in v0.4.0.
You can install the development version of GGFL like so:
devtools::install_github("ohishim/GGFL")
This package has an example dataset as the two objects exdata
and adj
.
The exdata
has 500 individuals and 22 items of which labels are "y", "X1", ..., "X20", and "area".
The "y" is a response variable, "X1", ..., "X20" are explanatory variables, and "area" is a variable of spatial information which has 20 areas.
This example requires the following package:
library(GGFL)
library(dplyr)
library(magrittr)
First, exdata
is sorted by "area", like this:
exdata1 <- arrange(exdata, area)
Moreover, column names of adj
are redefined as follows:
adj1 <- select(adj, area=areaNO, adj=adjNO)
Next, variables required for GGFL are extracted as follwos:
y <- exdata1$y
X <- select(exdata1, X1:X20) %>% data.matrix
area <- exdata1$area
Then, GGFL procedure can be executed as follows:
res <- GGFL(y, X, area, adj1)
In default, y
and all column vectors of X
are standardized in the sense of norm.
If you do not want to do it, you can use the option standardize = FALSE
.
If you want to have the estimates and fitted values, you can respectively obtain as res$coefGGFL
and res$fitGGFL
.
Here, these results are for the tuning parameter optimized by EGCV criterion.
To obtain results for all candidates of tuning parameter, you can use the option out.all = TRUE
.
In the above example, all variables are penalized.
When only partial variables are penalized, you can use pGGFL
instead of GGFL
, like this:
y <- exdata$y
X <- select(exdata, X1:X15) %>% cbind(X0=1, .) #variables for penalized estimation
Z <- select(exdata, X16:X20) #variables for non-penalized estimation
area <- exdata$area
yli <- split(y, area)
Xli <- lapply(split(X, area), data.matrix)
Zli <- lapply(split(Z, area), data.matrix)
D <- split(adj$adjNO, adj$areaNO)
res <- pGGFL(yli, Xli, Zli, D)
- Ohishi, M., Okamura, K., Itoh, Y., Wakaki, H. & Yanagihara, H. (2024). Coordinate descent algorithm for generalized group fused Lasso. Behaviormetrika (in press). doi: 10.1007/s41237-024-00233-6