Title: | Locally Sparse Estimator of Generalized Varying Coefficient Model for Asynchronous Longitudinal Data |
---|---|
Description: | Locally sparse estimator of generalized varying coefficient model for asynchronous longitudinal data by kernel-weighted estimating equation. |
Authors: | Rou Zhong [aut, cre], Jingxiao Zhang [aut] |
Maintainer: | Rou Zhong <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1 |
Built: | 2024-11-20 06:44:50 UTC |
Source: | CRAN |
Locally sparse estimator of generalized varying coefficient model for asynchronous longitudinal data by kernel-weighted estimating equation. The function is suitable for generalized varying coefficient model with one covariate.
LocKer( X, Y, family, X_obser_num, Y_obser_num, X_obser, Y_obser, timeint, L_list, roupen_para_list, lambda_list, absTol_list, nfold = 5, d = 3 )
LocKer( X, Y, family, X_obser_num, Y_obser_num, X_obser, Y_obser, timeint, L_list, roupen_para_list, lambda_list, absTol_list, nfold = 5, d = 3 )
X |
A |
Y |
A |
family |
A |
X_obser_num |
A |
Y_obser_num |
A |
X_obser |
A |
Y_obser |
A |
timeint |
A |
L_list |
A |
roupen_para_list |
A |
lambda_list |
A |
absTol_list |
A |
nfold |
An |
d |
An |
A list
containing the following components:
beta0fd_est |
A functional data object denoting the estimated intercept function. |
betafd_est |
A functional data object denoting the estimated coefficient function. |
time |
A |
L |
An |
roupen_select |
A |
lambda_select |
A |
EBIC |
A |
####Generate data n <- 200 beta0 <- function(x){cos(2 * pi * x)} beta <- function(x){sin(2 * pi * x)} Y_rate <- 15 X_rate <- 15 Y_obser_num <- NULL X_obser_num <- NULL Y_obser <- list() X_obser <- list() for(i in 1:n){ Y_obser_num[i] <- stats::rpois(1, Y_rate) + 1 Y_obser[[i]] <- stats::runif(Y_obser_num[i], 0, 1) X_obser_num[i] <- stats::rpois(1, X_rate) + 1 X_obser[[i]] <- stats::runif(X_obser_num[i], 0, 1) } ## The covariate functions Xi(t) X_basis <- fda::create.bspline.basis(c(0, 1), nbasis = 74, norder = 5, breaks = seq(0, 1, length.out = 71)) a <- matrix(0, nrow = n, ncol = 74) X <- list() XY <- list() #X at the observation time of Y muY <- list() for(i in 1:n){ a[i,] <- stats::rnorm(74) Xi_B <- splines::bs(X_obser[[i]], knots = seq(0, 1, length.out = 71)[-c(1, 71)], degree = 4, intercept = TRUE) X[[i]] <- Xi_B %*% a[i,] Yi_B <- splines::bs(Y_obser[[i]], knots = seq(0, 1, length.out = 71)[-c(1, 71)], degree = 4, intercept = TRUE) XY[[i]] <- Yi_B %*% a[i,] muY[[i]] <- beta0(Y_obser[[i]]) + XY[[i]] * beta(Y_obser[[i]]) } Y <- list() errY <- list() for(i in 1:n){ errY[[i]] <- stats::rnorm(Y_obser_num[[i]], mean = 0, sd = 1) Y[[i]] <- muY[[i]] + errY[[i]] } L_list <- 20 absTol_list <- 10^(-3) roupen_para_list <- 1.5 * 10^(-3) lambda_list <- c(0, 0.001, 0.002) LocKer_list <- LocKer(X, Y, family = "Gaussian", X_obser_num, Y_obser_num, X_obser, Y_obser, timeint = c(0, 1), L_list, roupen_para_list, lambda_list, absTol_list)
####Generate data n <- 200 beta0 <- function(x){cos(2 * pi * x)} beta <- function(x){sin(2 * pi * x)} Y_rate <- 15 X_rate <- 15 Y_obser_num <- NULL X_obser_num <- NULL Y_obser <- list() X_obser <- list() for(i in 1:n){ Y_obser_num[i] <- stats::rpois(1, Y_rate) + 1 Y_obser[[i]] <- stats::runif(Y_obser_num[i], 0, 1) X_obser_num[i] <- stats::rpois(1, X_rate) + 1 X_obser[[i]] <- stats::runif(X_obser_num[i], 0, 1) } ## The covariate functions Xi(t) X_basis <- fda::create.bspline.basis(c(0, 1), nbasis = 74, norder = 5, breaks = seq(0, 1, length.out = 71)) a <- matrix(0, nrow = n, ncol = 74) X <- list() XY <- list() #X at the observation time of Y muY <- list() for(i in 1:n){ a[i,] <- stats::rnorm(74) Xi_B <- splines::bs(X_obser[[i]], knots = seq(0, 1, length.out = 71)[-c(1, 71)], degree = 4, intercept = TRUE) X[[i]] <- Xi_B %*% a[i,] Yi_B <- splines::bs(Y_obser[[i]], knots = seq(0, 1, length.out = 71)[-c(1, 71)], degree = 4, intercept = TRUE) XY[[i]] <- Yi_B %*% a[i,] muY[[i]] <- beta0(Y_obser[[i]]) + XY[[i]] * beta(Y_obser[[i]]) } Y <- list() errY <- list() for(i in 1:n){ errY[[i]] <- stats::rnorm(Y_obser_num[[i]], mean = 0, sd = 1) Y[[i]] <- muY[[i]] + errY[[i]] } L_list <- 20 absTol_list <- 10^(-3) roupen_para_list <- 1.5 * 10^(-3) lambda_list <- c(0, 0.001, 0.002) LocKer_list <- LocKer(X, Y, family = "Gaussian", X_obser_num, Y_obser_num, X_obser, Y_obser, timeint = c(0, 1), L_list, roupen_para_list, lambda_list, absTol_list)