| Title: | A Comprehensive Analysis of High Dimensional Longitudinal Data |
|---|---|
| Description: | To provide a comprehensive analysis of high dimensional longitudinal data,this package provides analysis for any combination of 1) simultaneous variable selection and estimation, 2) mean regression or quantile regression for heterogeneous data, 3) cross-sectional or longitudinal data, 4) balanced or imbalanced data, 5) moderate, high or even ultra-high dimensional data, via computationally efficient implementations of penalized generalized estimating equations. |
| Authors: | Tianhai Zu [aut, cre], Brittany Green [aut, ctb], Yan Yu [aut, ctb] |
| Maintainer: | Tianhai Zu <[email protected]> |
| License: | GPL-3 |
| Version: | 0.3.1 |
| Built: | 2026-06-01 10:26:42 UTC |
| Source: | https://github.com/zzz1990771/geeverse |
This function reports correct percentage, TP, FP, MSE and MAD from a (list of) fitted qpgee model comparing to the true betas.
compile_result(qpgee_results, beta0, threshold = 10^-3)compile_result(qpgee_results, beta0, threshold = 10^-3)
qpgee_results |
A (list of) fitted qpgee model. |
beta0 |
True beta used in true data generation process. |
threshold |
Integer, the threshold to determine whether a estimated beta should be consider as 0. |
a vector contains correct percentage, TP, FP, MSE and MAD and its standard error if Monte Carlo simulations.
This function reports correct percentage, TP, FP, MSE and MAD from a (list of) fitted qpgee model comparing to the true betas.
## Default S3 method: compile_result(qpgee_results, beta0, threshold = 0.1)## Default S3 method: compile_result(qpgee_results, beta0, threshold = 0.1)
qpgee_results |
A (list of) fitted qpgee model. |
beta0 |
True beta used in true data generation process. |
threshold |
Integer, the threshold to determine whether a estimated beta should be consider as 0. |
a vector contains correct percentage, TP, FP, MSE and MAD and its standard error if Monte Carlo simulations.
This function reports correct percentage, TP, FP, MSE and MAD from a (list of) fitted qpgee model comparing to the true betas.
## S3 method for class 'qpgee' compile_result(qpgee_results, beta0, threshold = 10^-3)## S3 method for class 'qpgee' compile_result(qpgee_results, beta0, threshold = 10^-3)
qpgee_results |
A (list of) fitted qpgee model. |
beta0 |
True beta used in true data generation process. |
threshold |
Integer, the threshold to determine whether a estimated beta should be consider as 0. |
a vector contains correct percentage, TP, FP, MSE and MAD and its standard error if Monte Carlo simulations.
This function performs k-fold cross-validation for model selection in the context of Generalized Estimating Equations (GEE). It is designed to evaluate the performance of different models specified by a range of lambda values, choosing the one that minimizes the cross-validation criterion.
CVfit( formula, id, data, family, scale.fix, scale.value, fold, pindex, eps, maxiter, tol, lambda.vec = exp(seq(log(10), log(0.1), length.out = 30)), corstr = "independence", ncore = 1 )CVfit( formula, id, data, family, scale.fix, scale.value, fold, pindex, eps, maxiter, tol, lambda.vec = exp(seq(log(10), log(0.1), length.out = 30)), corstr = "independence", ncore = 1 )
formula |
an object of class |
id |
a vector which identifies the cluster/group for each observation. |
data |
an optional data frame containing the variables in the model. |
family |
a description of the error distribution and link function to be used in the model. |
scale.fix |
logical; if |
scale.value |
the value of the scale parameter when |
fold |
the number of folds to be used in the cross-validation. |
pindex |
an optional numeric vector specifying a parameter index. |
eps |
the threshold for convergence criteria. |
maxiter |
the maximum number of iterations for the convergence of the algorithm. |
tol |
the tolerance level for the convergence of the algorithm. |
lambda.vec |
a vector of lambda values for which the cross-validation error will be calculated. |
corstr |
the correlation structure used. |
ncore |
if greater than 1, the function will use parallel computation. |
Note that this is a re-implemented version with parallel computing.
An object of class "CVfit", which is a list containing:
foldThe number of folds used in the cross-validation.
lam.vectThe vector of lambda values tested.
cv.vectThe cross-validation error for each lambda.
lam.optThe lambda value that resulted in the minimum cross-validation error.
cv.minThe minimum cross-validation error.
callThe matched call.
This function is a wrapper for qpgee that allows running the model for multiple quantile levels (tau).
geeVerse(x, y, tau = c(0.25, 0.5, 0.75), ...)geeVerse(x, y, tau = c(0.25, 0.5, 0.75), ...)
x |
A matrix of predictors. |
y |
A numeric vector of response variables. |
tau |
A vector of quantiles to be estimated (default is c(0.25, 0.5, 0.75)). |
... |
Additional arguments to be passed to qpgee function. |
A list containing the results for each tau value and a combined beta matrix.
This function generates simulated data including the predictor matrix 'X' and the response vector 'y', based on the specified parameters. The function allows for the simulation of data under different settings of correlation, distribution, and the number of observations and subjects.
generate_data( nsub, nobs, p, beta0, rho, corstr = "AR1", dis = "normal", ka = 0, SNPs = NULL )generate_data( nsub, nobs, p, beta0, rho, corstr = "AR1", dis = "normal", ka = 0, SNPs = NULL )
nsub |
Integer, the number of subjects. |
nobs |
Integer or numeric vector, the number of observations per subject. |
p |
Integer, the number of predictors. |
beta0 |
Numeric vector, initial coefficients for the first few predictors. |
rho |
Numeric, the correlation coefficient used in generating correlated errors. |
corstr |
Character, specifies the correlation of correlation structure for the covariance matrix. Options are "cs" or "exchangeable" for compound symmetry, "AR1" for autoregressive, and any other input will result in an identity matrix. |
dis |
Character, the distribution of errors ("normal" or "t"). |
ka |
1 for heterogeneous errors and 0 for homogeneous errors. |
SNPs |
User can provide simulated or real SNPs for genetic data simulation. |
A list containing two elements: 'X', the matrix of predictors, and 'y', the response vector.
set.seed(123) sim_data <- generate_data( nsub = 50, nobs = rep(5, 50), p = 10, beta0 = c(rep(1, 5), rep(0, 5)), rho = 0.3 )set.seed(123) sim_data <- generate_data( nsub = 50, nobs = rep(5, 50), p = 10, beta0 = c(rep(1, 5), rep(0, 5)), rho = 0.3 )
A function to fit penalized generalized estimating equation model. This function was re-wrote partly with RCPP and RCPPEigen for better computation efficiency.
PGEE( formula, id, data, na.action = NULL, family = gaussian(link = "identity"), corstr = "independence", Mv = NULL, beta_int = NULL, R = NULL, scale.fix = TRUE, scale.value = 1, lambda, pindex = NULL, eps = 10^-6, maxiter = 30, tol = 10^-3, silent = TRUE, fastginv = TRUE )PGEE( formula, id, data, na.action = NULL, family = gaussian(link = "identity"), corstr = "independence", Mv = NULL, beta_int = NULL, R = NULL, scale.fix = TRUE, scale.value = 1, lambda, pindex = NULL, eps = 10^-6, maxiter = 30, tol = 10^-3, silent = TRUE, fastginv = TRUE )
formula |
A formula expression |
id |
A vector for identifying subjects/clusters. |
data |
A data frame which stores the variables in |
na.action |
A function to remove missing values from the data. Only |
family |
A |
corstr |
A character string, which specifies the correlation of correlation structure.
Structures supported in |
Mv |
If either |
beta_int |
User specified initial values for regression parameters. The default value is |
R |
If |
scale.fix |
A logical variable; if true, the scale parameter is fixed at the value of |
scale.value |
If |
lambda |
A numerical value for the penalization parameter of the scad function, which is estimated via cross-validation. |
pindex |
An index vector showing the parameters which are not subject to penalization. The default value
is |
eps |
A numerical value for the epsilon used in minorization-maximization algorithm. The default value is
|
maxiter |
The number of iterations that is used in the estimation algorithm. The default value is |
tol |
The tolerance level that is used in the estimation algorithm. The default value is |
silent |
A logical variable; if false, the regression parameter estimates at each iteration are
printed. The default value is |
fastginv |
A logical variable for usage of fast implementation of generalized matrix inverse. |
a PGEE object, which includes: fitted coefficients - the fitted single index coefficients with unit norm and first component being non negative
# generate data set.seed(2021) sim_data <- generate_data( nsub = 100, nobs = rep(10, 100), p = 100, beta0 = c(rep(1, 7), rep(0, 93)), rho = 0.6, corstr = "AR1", dis = "normal", ka = 1 ) PGEE_fit <- PGEE("y ~.-id-1", id = id, data = sim_data, corstr = "exchangeable", lambda = 0.01) PGEE_fit$coefficients# generate data set.seed(2021) sim_data <- generate_data( nsub = 100, nobs = rep(10, 100), p = 100, beta0 = c(rep(1, 7), rep(0, 93)), rho = 0.6, corstr = "AR1", dis = "normal", ka = 1 ) PGEE_fit <- PGEE("y ~.-id-1", id = id, data = sim_data, corstr = "exchangeable", lambda = 0.01) PGEE_fit$coefficients
Print summary method for qpgee model objects
## S3 method for class 'summary.qpgee' print(x, digits = max(3, getOption("digits") - 3), ...)## S3 method for class 'summary.qpgee' print(x, digits = max(3, getOption("digits") - 3), ...)
x |
A 'qpgee' model object. |
digits |
Default digits. |
... |
Additional arguments (not used). |
Prints a summary of the qpgee model.
Fits a quantile penalized generalized estimating equation (QPGEE) model for longitudinal data using penalized quantile regression with different working correlation structures.
qpgee(x, ...) ## S3 method for class 'formula' qpgee(x, id, data = parent.frame(), ...) ## Default S3 method: qpgee( x, y, nobs, tau = 0.5, corstr = "exchangeable", lambda = NULL, method = "HBIC", intercept = TRUE, betaint = NULL, nfold = 5, ncore = 1, control = qpgeeControl(), ... )qpgee(x, ...) ## S3 method for class 'formula' qpgee(x, id, data = parent.frame(), ...) ## Default S3 method: qpgee( x, y, nobs, tau = 0.5, corstr = "exchangeable", lambda = NULL, method = "HBIC", intercept = TRUE, betaint = NULL, nfold = 5, ncore = 1, control = qpgeeControl(), ... )
x |
A matrix of predictors. |
... |
Other arguments passed to methods. |
id |
A vector identifying the clusters (subjects). |
data |
An optional data frame. |
y |
A numeric vector of response variables. |
nobs |
A numeric vector of observations per subject. |
tau |
The quantile to be estimated (default is 0.5). |
corstr |
A string specifying the working correlation structure. Options include "exchangeable" (Exchangeable), "AR1" (Autoregressive), "Tri" (Tri-diagonal), "independence" (Independent), and "unstructured". |
lambda |
A vector of penalty parameters. If NULL, auto-selection is performed. |
method |
Criterion for penalty selection ("HBIC" or "CV"). |
intercept |
Logical; if TRUE, an intercept is added. |
betaint |
Initial values for the beta coefficients. If NULL, non-longitudinal quantile regression is used for initialization. |
nfold |
The number of folds used in cross-validation. |
ncore |
Number of cores for parallel processing. |
control |
A list of control parameters from 'qpgeeControl()', such as max_it, epsilon, shrinkCutoff, standardize and trace. |
An object of class 'qpgee'.
# Quick Example: # 1. Generate some data set.seed(123) sim_data <- generate_data( nsub = 50, nobs = rep(5, 50), p = 10, beta0 = c(rep(1, 5), rep(0, 5)), rho = 0.3 ) # 2. Fit the model using the formula interface fit <- qpgee( y ~ . - id, data = sim_data, id = sim_data$id, tau = 0.5, method = "HBIC" ) # 3. View the summary of the results summary(fit)# Quick Example: # 1. Generate some data set.seed(123) sim_data <- generate_data( nsub = 50, nobs = rep(5, 50), p = 10, beta0 = c(rep(1, 5), rep(0, 5)), rho = 0.3 ) # 2. Fit the model using the formula interface fit <- qpgee( y ~ . - id, data = sim_data, id = sim_data$id, tau = 0.5, method = "HBIC" ) # 3. View the summary of the results summary(fit)
Provides control parameters for the Quantile Penalized Generalized Estimating Equations (QPGEE) fitting procedure. Similar in spirit to 'geese.control()' in the geepack package.
qpgeeControl( epsilon = 1e-04, decay = 1, maxit = 100, trace = FALSE, standardize = FALSE, shrinkCutoff = 1e-04 )qpgeeControl( epsilon = 1e-04, decay = 1, maxit = 100, trace = FALSE, standardize = FALSE, shrinkCutoff = 1e-04 )
epsilon |
Convergence tolerance for the parameter estimates. Iteration stops when the maximum change in coefficients is below this value. |
decay |
Decay rate of learning step. |
maxit |
Maximum number of iterations. |
trace |
Logical indicating if output should be produced for each iteration. (You can decide how much information to show inside the C++/R loop.) |
standardize |
Logical indicating whether to scale X. |
shrinkCutoff |
Threshold below which coefficients are shrunk to zero (removal of “small” coefficients). |
A list with the components epsilon, maxit,
trace, and shrinkCutoff.
ctrl <- qpgeeControl(epsilon = 1e-5, maxit = 200, trace = TRUE)ctrl <- qpgeeControl(epsilon = 1e-5, maxit = 200, trace = TRUE)
This function generates a covariance matrix based on the specified correlation structure. The function supports "compound symmetry" (cs) and "autoregressive" (ar) correlation structures, as well as an identity matrix as the default option when neither "cs" nor "AR1" is specified.
Siga_cov(rho, corstr, nt)Siga_cov(rho, corstr, nt)
rho |
Numeric, the correlation coefficient used for generating the covariance matrix. For "cs" or "exchangeable", it represents the common correlation between any two observations. For "AR1", it represents the correlation between two consecutive observations, with the correlation decreasing for observations further apart. |
corstr |
Character, specifies the correlation of correlation structure for the covariance matrix. Options are "cs" or "exchangeable" for compound symmetry, "AR1" for autoregressive, and any other input will result in an identity matrix. |
nt |
Integer, the dimension of the square covariance matrix (number of time points or observations). |
A square matrix of dimension 'nt' representing the specified covariance structure.
The 'simuGene' dataset contains 500 SNPs simulated data from a commonly used tool for genetic data, HapGen2. We re-sampled existing genotype data to create this simulated data. The genotype data we resample from is the publicly available 1000 Genomes Project data. More specifically, we use resampled from chromosome 14.
simuGenesimuGene
A data frame with 1000 rows (subjects) and 500 columns (SNPs).
data(simuGene) head(simuGene)data(simuGene) head(simuGene)
The 'yeastG1' dataset contains gene expression data from the yeast cell cycle during the G1 phase. The original dataset (Spellman et al. 1998) includes expression levels for 6178 genes measured at 18 time points. And this is a subset of 283 cell-cycled-regularized genes observed over 4 time points at G1 stage and the standardized binding probabilities of a total of 96 TFs obtained from
yeastG1yeastG1
A data frame with 1132 rows and 99 columns.
The dataset contains gene expression levels for the following transcription factors: ABF1, ACE2, ADR1, ARG80, ARG81, ARO80, ASH1, BAS1, CAD1, CBF1, CIN5, CRZ1, CUP9, DAL81, DAL82, DIG1, DOT6, FHL1, FKH1, FKH2, FZF1, GAL4, GAT1, GAT3, GCN4, GCR1, GCR2, GLN3, GRF10.Pho2., GTS1, HAL9, HAP2, HAP3, HAP4, HAP5, HIR1, HIR2, HMS1, HSF1, IME4, INO2, INO4, IXR1, LEU3, MAC1, MAL13, MATa1, MBP1, MCM1, MET31, MET4, MIG1, MOT3, MSN1, MSN4, MSS11, MTH1, NDD1, NRG1, PDR1, PHD1, PHO4, PUT3, RAP1, RCS1, REB1, RFX1, RGM1, RLM1, RME1, ROX1, RPH1, RTG1, RTG3, SFP1, SIG1, SIP4, SKN7, SMP1, SOK2, SRD1, STB1, STE12, STP1, STP2, SUM1, SWI4, SWI5, SWI6, YAP1, YAP5, YAP6, YFL044C, YJL206C, ZAP1, ZMS1
Spellman, P. T., Sherlock, G., Zhang, M. Q., Iyer, V. R., Anders, K., Eisen, M. B., ... & Futcher, B. (1998). Comprehensive identification of cell cycle-regulated genes of the yeast Saccharomyces cerevisiae by microarray hybridization. Molecular biology of the cell, 9(12), 3273-3297.
Wang, L., Zhou, J., and Qu, A. (2012). Penalized generalized estimating equations for high-dimensional longitudinal data analysis. Biometrics, 68, 353–360.
data(yeastG1) head(yeastG1)data(yeastG1) head(yeastG1)