LocKer {LocKer} | R Documentation |
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. The function is suitable for generalized varying coefficient model with one covariate.
Usage
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
)
Arguments
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 |
Value
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 |
Examples
####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)