| Title: | Sieve Maximum Kernel-Weighted Log-Likelihood Estimation |
| Version: | 0.1.0 |
| Description: | Estimation and inference when a longitudinal covariate is observed sparsely and intermittently, at times that do not line up with the times at which the outcome is measured. For a survival outcome, fits the transformed hazards family – proportional hazards, additive hazards, and the Box-Cox transformations between them – by the Sieve Maximum Kernel-weighted Log-likelihood Estimator (SMKLE) of Sun, Sun, Zhao and Cao (2025) <doi:10.1080/01621459.2025.2476781>, with specialised kernel estimating-equation alternatives for the proportional and additive cases. For a longitudinal outcome recorded on its own time grid, fits generalised linear models by the kernel-weighted estimating equations of Cao, Zeng and Fine (2015) <doi:10.1111/rssb.12086>, with either time-invariant or time-dependent coefficients. Half and full kernels, data simulation, and bandwidth selection by cross-validation are available throughout, and the numerical routines use 'Rcpp', 'RcppArmadillo' and the 'nloptr' C API. |
| URL: | https://www.sundayu.me/skmle/, https://github.com/dayusun/skmle |
| BugReports: | https://github.com/dayusun/skmle/issues |
| Depends: | R (≥ 4.1) |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| SystemRequirements: | C++17 |
| LinkingTo: | Rcpp, RcppArmadillo, nloptr |
| Imports: | dplyr, gaussquad, generics, graphics, ggplot2, nleqslv, nloptr, Rcpp, rlang, splines, stats, survival, tibble, utils |
| Suggests: | bench, knitr, pkgdown, rmarkdown, SurvSparse, testthat (≥ 3.0.0) |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | yes |
| Packaged: | 2026-11-12 19:22:59 UTC; commintern |
| Author: | Dayu Sun [aut, cre, cph] |
| Maintainer: | Dayu Sun <dayusun@iu.edu> |
| Repository: | CRAN |
| Date/Publication: | 2026-12-05 15:00:08 UTC |
skmle: Sieve Maximum Kernel-Weighted Log-Likelihood Estimation
Description
Estimation and inference when a longitudinal covariate is observed sparsely and intermittently, at times that do not line up with the times at which the outcome is measured. For a survival outcome, fits the transformed hazards family – proportional hazards, additive hazards, and the Box-Cox transformations between them – by the Sieve Maximum Kernel-weighted Log-likelihood Estimator (SMKLE) of Sun, Sun, Zhao and Cao (2025) doi:10.1080/01621459.2025.2476781, with specialised kernel estimating-equation alternatives for the proportional and additive cases. For a longitudinal outcome recorded on its own time grid, fits generalised linear models by the kernel-weighted estimating equations of Cao, Zeng and Fine (2015) doi:10.1111/rssb.12086, with either time-invariant or time-dependent coefficients. Half and full kernels, data simulation, and bandwidth selection by cross-validation are available throughout, and the numerical routines use 'Rcpp', 'RcppArmadillo' and the 'nloptr' C API.
Details
A longitudinal covariate is rarely measured at the time you need it. skmle
handles that mismatch directly, by weighting each observation according to
how far its measurement time sits from the time being modelled, rather than
carrying a value forward or smoothing the covariate and substituting it.
Two outcome types are covered.
Which function do I need?
Answer two questions.
First, what is the outcome?
- A time to an event
(death, relapse, failure), possibly censored – use the survival estimators. Your data is one long table with a row per covariate measurement.
- A repeatedly measured quantity
(a score, a lab value) recorded on its own schedule – use the asynchronous estimators. Your data is two tables, one per process.
Then pick within that group.
| Outcome | Situation | Function |
| Survival | Start here; Cox model | kee_cox() |
| Survival | Additive hazards instead | kee_additive() |
| Survival | Want the baseline hazard, or a model between the two | skmle() |
| Survival | Choose the bandwidth | skmle_cv() |
| Longitudinal | Start here; one constant effect | kee_async() |
| Longitudinal | The effect may change over time | kee_async_td()
|
Every fitting function will pick a bandwidth for you if you do not supply
one, and will say in a message what it chose. For the survival models, use
skmle_cv() to choose the bandwidth from the data.
Survival outcomes
skmle() fits the transformed hazards family by the Sieve Maximum
Kernel-weighted Log-likelihood Estimator of Sun, Sun, Zhao and Cao (2025).
The Box-Cox parameter s indexes the family: s = 0 is proportional
hazards, s = 1 is additive hazards, and other values interpolate.
kee_cox() and kee_additive() are faster specialised estimating equations
for the two named cases, and skmle_cv() selects the bandwidth by
subject-level cross-validation. Simulate with sim_skmle_data().
Asynchronous longitudinal outcomes
When the outcome is itself a sparsely observed longitudinal process, recorded
on a time grid that does not line up with the covariate's, kee_async() and
kee_async_td() fit generalised linear models by the kernel-weighted
estimating equations of Cao, Zeng and Fine (2015), with time-invariant
coefficients and with a coefficient curve \beta(t) respectively.
Simulate with sim_async_data().
Half and full kernels
Every estimator takes one_sided. A half kernel admits only measurements
strictly before the time being modelled, which is the risk-set restriction of
a hazard model and the causal reading of a covariate path; a full kernel
smooths from both sides. The survival estimators default to the half kernel,
as published; the asynchronous ones default to the full kernel, as published.
Author(s)
Maintainer: Dayu Sun dayusun@iu.edu [copyright holder]
Authors:
Dayu Sun dayusun@iu.edu [copyright holder]
References
Sun, D., Sun, Z., Zhao, X. and Cao, H. (2025). Kernel meets sieve: transformed hazards models with sparse longitudinal covariates. Journal of the American Statistical Association 120, 2580-2591.
Cao, H., Zeng, D. and Fine, J. P. (2015). Regression analysis of sparse asynchronous longitudinal data. Journal of the Royal Statistical Society, Series B 77, 755-776.
See Also
Useful links:
Report bugs at https://github.com/dayusun/skmle/issues
Tell the user which bandwidth was chosen for them
Description
Tell the user which bandwidth was chosen for them
Usage
announce_bandwidth(h, cv_fun = NULL)
Arguments
h |
The chosen bandwidth. |
cv_fun |
Name of the cross-validation function to point at, or |
Value
h, invisibly.
Add fitted means to the covariate table
Description
Fitted means belong to covariate occasions. The estimating equation
evaluates the link at each observed covariate vector, and the kernel weight
is what ties that vector to a response occasion. So augment() returns
data_x with a .fitted column, g(X_i(S_{ik})^\top \hat\beta).
Usage
## S3 method for class 'kee_async'
augment(x, data_x, ...)
Arguments
x |
A |
data_x |
The covariate table the fit was made from. |
... |
Unused. |
Details
The fit does not retain its data, so data_x must be supplied.
Value
data_x as a tibble with a .fitted column added.
Examples
set.seed(1)
d <- sim_async_data(n = 150)
fit <- kee_async(d$y, d$x, y ~ x, id = id, time = time, h = 0.3)
augment(fit, d$x)
Validate the time scale
Description
Times may be on any scale. The sieve basis and the cumulative-hazard
quadrature are built on [0, max(X_time)], so nothing has to be rescaled to
the unit interval first; that was a convention of the original prototype
rather than a requirement of the method. What is required of X_time is
that it is finite and non-negative, and that follow-up has positive length.
Usage
check_time_scale(X_time, obs_times_vec)
Arguments
X_time |
Event or censoring times. |
obs_times_vec |
Covariate observation times. May be negative. |
Details
obs_times_vec is held to the weaker standard of being finite, and may be
negative. No basis and no quadrature rule is ever evaluated at a covariate
observation time: it reaches the score only through the lag
X_time - obs_times_vec, and the one-sided rule tests the sign of that lag,
not the sign of the time. The earlier non-negativity requirement applied a
constraint belonging to X_time to an argument that does not carry it. A
negative observation time means a covariate measured before the time origin,
which is a scientific statement about the data and not a numerical one; see
“Negative observation times” in kee_cox().
Value
NULL, invisibly. Called for the error.
Wald confidence intervals for a coefficient curve
Description
Pointwise Wald intervals at each target time.
Usage
## S3 method for class 'kee_td'
confint(object, parm, level = 0.95, ...)
Arguments
object |
A |
parm |
Coefficients to report, by name or position. Defaults to all. |
level |
Confidence level. |
... |
Unused. |
Details
For skmle and kee fits no method is needed: stats::confint.default()
works once vcov() is available.
Value
A data frame with one row per (target time, coefficient) and columns
time, term, estimate, se, and the two interval endpoints.
Examples
set.seed(1)
d <- sim_async_data(n = 200, beta = function(tt) cbind(0.5, 1 + tt))
fit <- kee_async_td(d$y, d$x,
y ~ x, id = id, time = time,
times = c(0.3, 0.5, 0.7), h = 0.3
)
confint(fit)
Rows that carry a feasibility constraint
Description
For s != 0 the transformed hazard needs 1 + s * eta > 0 wherever the
objective evaluates it with nonzero weight. A row is constrained when its
lag falls in the weight's declared support or its weight is nonzero, and,
under one_sided, its lag is positive. For the Epanechnikov kernels this is
exactly the earlier |lag| <= h rule; for a weight reaching further than
h it follows the weight. skmle_cv_cpp() applies the same rule.
Usage
constraint_rows(lag, kerval, h, weight, one_sided)
Arguments
lag |
|
kerval |
Row weights from |
h, weight, one_sided |
As for |
Value
Logical vector.
Default bandwidth for the asynchronous estimators
Description
A rule of thumb, 2 (Q_3 - Q_1) n^{-1/2}, so it adapts to whatever units time is in.
Usage
default_bandwidth_async(times, n)
Arguments
times |
Pooled observation times from both tables. |
n |
Number of subjects. |
Value
A positive bandwidth.
Default bandwidth for the survival estimators
Description
Geometric midpoint of the grid skmle_cv() searches, which is built from the
observed lags between covariate observation times and event times.
Usage
default_bandwidth_surv(X_time, obs_times, n)
Arguments
X_time, obs_times |
Event/censoring and covariate observation times. |
n |
Number of subjects. |
Value
A positive bandwidth.
Row weights from a weight function
Description
The one place a weight is turned into the numbers the estimators use, so
there is one description of any given kernel rather than one per call site.
epan_kernel() is kept because three fitting functions used to write the
Epanechnikov out inline and older code may still reach for it.
Usage
epan_kernel(u)
kernel_weights(lag, h, weight = NULL, one_sided = TRUE)
Arguments
u |
Numeric vector or matrix of standardised lags. |
lag |
Raw time difference |
h |
Positive bandwidth. |
weight |
A weight function of the standardised lag, or |
one_sided |
Logical. When |
Value
epan_kernel() returns 0.75(1 - u^2)_+, shape preserved.
kernel_weights() returns the scaled weights W(lag/h)/h.
One-row summary of a fit
Description
One-row summary of a fit
Usage
## S3 method for class 'skmle'
glance(x, ...)
## S3 method for class 'kee'
glance(x, ...)
## S3 method for class 'kee_td'
glance(x, ...)
Arguments
x |
A fitted |
... |
Unused. |
Value
A one-row tibble. nobs is the number of subjects.
Examples
set.seed(1)
d <- sim_async_data(n = 150)
fit <- kee_async(d$y, d$x, y ~ x, id = id, time = time, h = 0.3)
glance(fit)
Fit an Additive Hazards KEE Model
Description
Fit the additive hazards model for sparse longitudinal covariate data using a kernel estimating-equation approach.
Usage
kee_additive(
formula,
data,
id,
obs_times,
h = NULL,
lq_nodes = 64,
one_sided = TRUE,
weight = NULL
)
Arguments
formula |
A model formula with a |
data |
Data frame containing all variables used in the fit. |
id |
Subject identifier aligned row-wise with |
obs_times |
Longitudinal observation times aligned row-wise with |
h |
Positive kernel bandwidth. If omitted, one is read off the
observation times as a rule of thumb and reported in a message. Use
|
lq_nodes |
Number of quadrature nodes used in the numerical integration step. |
one_sided |
Logical. |
weight |
Weight function of the standardised lag |
Details
kee_additive() is the specialized additive-hazards counterpart to kee_cox().
It uses a kernel-smoothed martingale estimating equation and typically runs faster
than the general skmle(s = 1) fit because it solves a more specialized problem.
Value
An object of class kee containing coefficient estimates, an estimated
variance-covariance matrix, intermediate matrices used for sandwich variance
estimation, and model metadata.
References
Sun, Dayu, Zhuowei Sun, Xingqiu Zhao, and Hongyuan Cao. "Kernel Meets Sieve: Transformed Hazards Models with Sparse Longitudinal Covariates." Journal of the American Statistical Association 120(552), 2580-2591. doi:10.1080/01621459.2025.2476781
Sun, Zhuowei, Hongyuan Cao, and Li Chen. "Regression Analysis of Additive Hazards Model with Sparse Longitudinal Covariates." Lifetime Data Analysis (2022). doi:10.1007/s10985-022-09548-6
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 80,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 1,
cen = 0.7
)
fit_add <- kee_additive(
Surv(X, delta) ~ covariates,
data = dat,
id = id,
obs_times = obs_times,
h = 0.5
)
summary(fit_add)
Asynchronous longitudinal regression with time-invariant coefficients
Description
Regress a sparsely observed longitudinal response on a sparsely observed longitudinal covariate when the two are measured on different time grids and are never seen together.
Each response occasion T_{ij} is paired with every covariate occasion
S_{ik} of the same subject, and each pair contributes in proportion to
its time separation, so no pair is discarded and no value is carried forward.
The estimator solves the kernel-weighted estimating equation of Cao, Zeng and
Fine (2015),
U_n(\beta) = n^{-1} \sum_i \sum_j \sum_k W_h(T_{ij} - S_{ik})
X_i(S_{ik}) [ Y_i(T_{ij}) - g\{X_i(S_{ik})^\top \beta\} ] = 0,
with W_h(u) = W(u/h)/h and W the Epanechnikov kernel.
Usage
kee_async(
data_y,
data_x,
formula,
id,
time,
h = NULL,
one_sided = FALSE,
link = c("identity", "log", "logistic"),
intercept = TRUE,
maxit = 50L,
tol = 1e-08
)
Arguments
data_y |
Data frame of response occasions: one row per time the response was recorded. First argument, so the function pipes. |
data_x |
Data frame of covariate occasions: one row per time the
covariates were recorded. Its time grid need not overlap |
formula |
A two-sided formula, |
id |
Subject identifier naming a column present in both tables.
Give it unquoted ( |
time |
Observation time, naming a column present in both tables.
Accepts the same three forms as |
h |
Positive bandwidth, on the same scale as |
one_sided |
Logical. |
link |
One of |
intercept |
Logical, include an intercept. |
maxit, tol |
Newton-Raphson controls, ignored when |
Value
An object of class kee with components
- coefficients
Named coefficient vector.
- var
Sandwich covariance matrix
A^{-1} B A^{-1}.- A, Sigma
The bread and the meat of the sandwich.
- scores
Per-subject score contributions, one row per subject;
Sigmaiscrossprod(scores).- n
Number of subjects, the unit the asymptotics are in.
- npair
Number of weighted (response, covariate) pairs contributing.
- h, one_sided, link
Fit settings.
- convergence
0converged,1singular,2hitmaxit.- call
The matched call.
coef(), vcov(), confint(), nobs(), print() and summary() methods
are available.
Bandwidth
h is on the same scale as the observation times. Small h admits few
pairs; large h admits pairs far apart in time. Fit at a few values of h
and compare the estimates. A warning is issued when fewer than 5% of response
occasions have any covariate observation in their window, which usually means
h is on the wrong scale.
Half kernel or full kernel
one_sided = FALSE, the default, is the full two-sided kernel of the paper.
one_sided = TRUE admits only covariate observations strictly before the
response. It uses roughly half the pairs, so it needs a larger h for the
same effective sample size.
Observation times are assumed independent of the response and covariate processes.
References
Cao, H., Zeng, D. and Fine, J. P. (2015). Regression analysis of sparse asynchronous longitudinal data. Journal of the Royal Statistical Society, Series B 77, 755-776.
See Also
kee_async_td() for a coefficient curve \beta(t),
sim_async_data() to simulate.
Examples
set.seed(1)
d <- sim_async_data(n = 150, beta = c(0.5, 1.5))
# The two tables are on different time grids and share only `id`.
head(d$y, 3)
head(d$x, 3)
fit <- kee_async(d$y, d$x, y ~ x, id = id, time = time, h = 0.25)
summary(fit)
confint(fit)
tidy(fit, conf.int = TRUE)
# Data comes first, so it pipes.
d$y |>
kee_async(d$x, y ~ x, id = id, time = time, h = 0.25) |>
glance()
# Half kernel: only covariate observations preceding the response.
kee_async(d$y, d$x, y ~ x, id = id, time = time, h = 0.25, one_sided = TRUE)
Asynchronous longitudinal regression with time-dependent coefficients
Description
Fit E\{Y(t) \mid X(t)\} = g\{X(t)^\top \beta(t)\} from asynchronous
sparse longitudinal data, estimating the coefficient curve \beta(t)
pointwise. This is the time-dependent coefficient estimator of Cao, Zeng and
Fine (2015), the companion to kee_async().
At a target time t a response occasion and a covariate occasion are
weighted by their separate distances to t,
U_n\{\beta(t)\} = n^{-1} \sum_i \sum_j \sum_k W_{h_1}(t - T_{ij})
W_{h_2}(t - S_{ik}) X_i(S_{ik})
[ Y_i(T_{ij}) - g\{X_i(S_{ik})^\top \beta(t)\} ] = 0.
The lag between the two occasions never enters, only their distances to
t. That is the difference from kee_async(), where the lag is
everything.
Usage
kee_async_td(
data_y,
data_x,
formula,
id,
time,
times = NULL,
h = NULL,
h2 = h,
one_sided = FALSE,
link = c("identity", "log", "logistic"),
intercept = TRUE,
maxit = 50L,
tol = 1e-08
)
## S3 method for class 'kee_td'
print(x, ...)
Arguments
data_y |
Data frame of response occasions: one row per time the response was recorded. First argument, so the function pipes. |
data_x |
Data frame of covariate occasions: one row per time the
covariates were recorded. Its time grid need not overlap |
formula |
A two-sided formula, |
id |
Subject identifier naming a column present in both tables.
Give it unquoted ( |
time |
Observation time, naming a column present in both tables.
Accepts the same three forms as |
times |
Numeric vector of target times at which to estimate
|
h |
Bandwidth for the response side, |
h2 |
Bandwidth for the covariate side, |
one_sided |
Logical. |
link |
One of |
intercept |
Logical, include an intercept. |
maxit, tol |
Newton-Raphson controls, ignored when |
x |
A |
... |
Ignored. |
Value
An object of class kee_td:
- coefficients
length(times)bypmatrix of\hat\beta(t).- se, z, p.value
Pointwise standard errors and Wald statistics, the same shape as
coefficients.- var
List of
p \times psandwich matrices, one per target time.- times, h, h2, one_sided, link, n
Fit settings.
- nactive
Covariate rows carrying nonzero weight at each target time.
- convergence
Per target time:
0converged,1singular,2hitmaxit,3no data in the window.
coef(), vcov(), confint(), nobs(), print() and plot() methods are
available.
Reading the output
se holds sandwich standard errors at each target time; the bands drawn by
plot.kee_td() are pointwise. Keep times inside the observed time range.
Both time arguments are smoothed, so the curve needs more data than a
time-invariant fit from kee_async().
Cost
The product weight factorises over the two occasion indices, so no pair is
ever enumerated: the response side collapses to two per-subject scalars and
the covariate side to one weight per row. Each target time costs
O(n_y + n_x p^2). Fits at successive target times are warm-started from
the previous solution when the link is nonlinear.
References
Cao, H., Zeng, D. and Fine, J. P. (2015). Regression analysis of sparse asynchronous longitudinal data. Journal of the Royal Statistical Society, Series B 77, 755-776.
See Also
Examples
set.seed(1)
d <- sim_async_data(n = 200, beta = function(tt) cbind(0.5, 1 + tt))
fit <- d$y |>
kee_async_td(d$x, y ~ x,
id = id, time = time,
times = seq(0.2, 0.8, by = 0.1), h = 0.3
)
coef(fit)
tidy(fit)
Fit a Cox-Type KEE Model
Description
Fit the proportional hazards model for sparse longitudinal covariate data using a kernel estimating-equation approach.
Usage
kee_cox(
formula,
data,
id,
obs_times,
h = NULL,
one_sided = TRUE,
weight = NULL
)
Arguments
formula |
A model formula with a |
data |
Data frame containing all variables used in the fit. |
id |
Subject identifier aligned row-wise with |
obs_times |
Longitudinal observation times aligned row-wise with |
h |
Positive kernel bandwidth. If omitted, one is read off the
observation times as a rule of thumb and reported in a message. Use
|
one_sided |
Logical. |
weight |
Weight function of the standardised lag |
Details
kee_cox() targets the proportional hazards case without estimating a nonparametric
baseline component. It is therefore a useful specialized alternative to skmle()
when the scientific model is Cox-type and the main interest is in the regression
coefficients.
Value
An object of class kee containing coefficient estimates, the estimated
variance-covariance matrix, the estimating-equation matrices W and
Sigma, the per-subject score contributions scores (one row per subject,
so that Sigma is crossprod(scores) / n^2), convergence status, and the
original function call.
Negative observation times
obs_times may be negative. Event times may not, and a negative event time
is an error: in skmle() and kee_additive() the sieve basis and the
cumulative-hazard quadrature are built on [0, max(X)], and every estimator
takes the time origin to be zero. Observation times carry no such
constraint. They enter the score only through the lag X - obs_times, and
the half kernel admits a row on the sign of that lag rather than on the sign
of the time, so a covariate observed at -180 and an event at 30 sit a lag
of 210 apart and are handled like any other pair.
A pre-origin observation contributes only where it falls within h of an
event time. Use negative times for ordinary measurements taken before entry
on the same scale, such as a run-in visit or a screening draw.
References
Sun, Dayu, Zhuowei Sun, Xingqiu Zhao, and Hongyuan Cao. "Kernel Meets Sieve: Transformed Hazards Models with Sparse Longitudinal Covariates." Journal of the American Statistical Association 120(552), 2580-2591. doi:10.1080/01621459.2025.2476781
Cao, Hongyuan, Mathew M. Churpek, Donglin Zeng, and Jason P. Fine. "Analysis of the Proportional Hazards Model with Sparse Longitudinal Covariates." Journal of the American Statistical Association 110(511), 1187-1196 (2015). doi:10.1080/01621459.2014.957289
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 80,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
fit_cox <- kee_cox(
Surv(X, delta) ~ covariates,
data = dat,
id = id,
obs_times = obs_times,
h = 0.5
)
summary(fit_cox)
Kernel weight functions
Description
A weight function says how much a covariate observation at lag u from a
time contributes to the estimating equation at that time, where u is the
lag divided by the bandwidth. Every estimator in this package takes one
through its weight argument, and any R function of u will do: the
Epanechnikov kernels here are a starting point, not the only option.
Usage
w_epan_half()
w_epan_full()
Value
A function of one argument, the standardised lag
u = (t - r)/h as a vector or a matrix, returning the weight with the
shape of its argument preserved and carrying a support attribute.
Functions
-
w_epan_half(): The Epanechnikov half kernel0.75(1 - u^2)_+on[0, 1], the default for the survival estimators and the weight every published result in this package was computed with. -
w_epan_full(): The Epanechnikov full kernel0.75(1 - u^2)_+on[-1, 1], the default for the asynchronous longitudinal estimators and the kernel of Cao, Zeng and Fine (2015). Symmetry kills the first moment, so it is order 2.
Writing your own
A weight is a function of one argument, the standardised lag
u = (t - r)/h, returning a value of the same shape. It is called on
vectors and on matrices, and it must preserve the shape it is given: the
sieve quadrature evaluates it on a matrix of node-by-observation lags. Zero
outside its own support is the function's own responsibility.
gauss_half <- function(u) exp(-u^2 / 2) * (u >= 0 & u <= 3)
kee_cox(Surv(X, delta) ~ z, data, id = id, obs_times = r,
h = 0.3, weight = gauss_half)
Nothing about the function has to be polynomial, nonnegative or symmetric. A weight that takes negative values is supported throughout: the estimating equations admit a row on whether its weight is nonzero, not on whether it is positive.
support is the one attribute worth setting, as a length-2 numeric giving
the interval outside which the weight is zero. It is used to enumerate pairs
in the asynchronous estimators, where scanning every pair would otherwise be
quadratic, and to choose the rows that carry a feasibility constraint in
skmle() with s != 0. Without it a default of [-1, 1] is assumed; the
constraint rows also include every row whose weight is nonzero, so a
missing attribute never leaves a weighted row unconstrained.
The same weight is used in every term of each estimating equation: the row
weights, the risk-set averages and, for skmle(), the cumulative-hazard
integral and both sandwich matrices. Nothing in the package falls back to a
built-in kernel.
Scaling
The weight is used as W(u)/h. A weight that integrates to something
other than 1 is not wrong: the normalisation cancels wherever the weight
appears in a ratio, which is everywhere in the risk-set averages, and is
absorbed into h elsewhere. w_epan_half() integrates to 1/2 for that
reason and is the weight every published result in this package used.
The one-sided restriction is separate
one_sided is a modelling choice, not a property of the weight. It is the
risk-set restriction of a hazard model: only covariate observations strictly
before a time may inform it. It is applied on the sign of the lag after the
weight has been evaluated, so a two-sided weight under one_sided = TRUE is
truncated at zero rather than rejected.
Examples
W <- w_epan_half()
W(c(-0.5, 0, 0.5, 1, 1.5))
attr(W, "support")
# Any function of the standardised lag is a weight.
tri <- function(u) pmax(1 - abs(u), 0)
tri(c(-0.5, 0, 0.5))
Number of subjects contributing to a fit
Description
Returns the number of subjects, which is what summary() prints as n.
Usage
## S3 method for class 'skmle'
nobs(object, ...)
## S3 method for class 'kee'
nobs(object, ...)
## S3 method for class 'kee_td'
nobs(object, ...)
Arguments
object |
A fitted |
... |
Unused. |
Value
An integer, the number of subjects.
Examples
set.seed(1)
d <- sim_async_data(n = 120)
fit <- kee_async(d$y, d$x, y ~ x, id = id, time = time, h = 0.3)
nobs(fit)
Plot a cross-validation curve
Description
The held-out loss against the candidate bandwidths, with the selected value marked. Worth a glance every time: if the curve is still falling at an endpoint of the grid, the "selected" bandwidth is where you stopped looking rather than a minimum, and the grid should be widened.
Usage
## S3 method for class 'cv.skmle'
plot(x, ...)
Arguments
x |
A |
... |
Passed to |
Value
x, invisibly. Called for the plot.
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 60,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
cv <- skmle_cv(Surv(X, delta) ~ covariates, data = dat, id = id,
obs_times = obs_times, s = 0, K = 3, seed = 2026, quiet = TRUE)
plot(cv)
Plot estimated coefficient curves
Description
Draws \hat\beta_j(t) against t with pointwise Wald bands, one panel
per coefficient.
Usage
## S3 method for class 'kee_td'
plot(x, which = seq_len(ncol(x$coefficients)), level = 0.95, ...)
Arguments
x |
A |
which |
Integer or character vector selecting coefficients to draw. Defaults to all. |
level |
Confidence level for the pointwise bands. |
... |
Passed to |
Value
x, invisibly. Called for the plot.
Examples
set.seed(1)
d <- sim_async_data(n = 200, beta = function(tt) cbind(0.5, 1 + tt))
fit <- d$y |>
kee_async_td(d$x, y ~ x,
id = id, time = time,
times = seq(0.2, 0.8, by = 0.05), h = 0.3
)
plot(fit)
Plot the estimated baseline function for skmle model
Description
Plot the estimated baseline function for skmle model
Usage
## S3 method for class 'skmle'
plot(x, t_seq = NULL, ...)
Arguments
x |
An object of class |
t_seq |
Time points at which to evaluate the baseline. Defaults to 100 points spanning the follow-up the model was fitted on. |
... |
Further arguments passed to or from other methods. |
Value
A ggplot object showing the estimated nonparametric baseline
function evaluated on t_seq.
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 60,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
fit <- skmle(Surv(X, delta) ~ covariates, data = dat, id = id,
obs_times = obs_times, s = 0, h = 0.5, nknots = 3)
plot(fit)
Print kee object
Description
Print kee object
Usage
## S3 method for class 'kee'
print(x, ...)
Arguments
x |
An object of class |
... |
Further arguments passed to or from other methods. |
Value
x, invisibly. Called for its side effect of printing a brief
summary of the call and estimated coefficients.
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 60,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
fit <- kee_cox(Surv(X, delta) ~ covariates, data = dat, id = id,
obs_times = obs_times, h = 0.5)
print(fit)
Print skmle object
Description
Print skmle object
Usage
## S3 method for class 'skmle'
print(x, ...)
Arguments
x |
An object of class |
... |
Further arguments passed to or from other methods. |
Value
x, invisibly. Called for its side effect of printing a brief
summary of the call and estimated coefficients.
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 60,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
fit <- skmle(Surv(X, delta) ~ covariates, data = dat, id = id,
obs_times = obs_times, s = 0, h = 0.5, nknots = 3)
print(fit)
Print summary of kee object
Description
Print summary of kee object
Usage
## S3 method for class 'summary.kee'
print(x, ...)
Arguments
x |
An object of class |
... |
Further arguments passed to or from other methods. |
Value
x, invisibly. Called for its side effect of printing the
summary table.
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 60,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
fit <- kee_cox(Surv(X, delta) ~ covariates, data = dat, id = id,
obs_times = obs_times, h = 0.5)
print(summary(fit))
Print summary of skmle object
Description
Print summary of skmle object
Usage
## S3 method for class 'summary.skmle'
print(x, ...)
Arguments
x |
An object of class |
... |
Further arguments passed to or from other methods. |
Value
x, invisibly. Called for its side effect of printing the
summary table.
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 60,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
fit <- skmle(Surv(X, delta) ~ covariates, data = dat, id = id,
obs_times = obs_times, s = 0, h = 0.5, nknots = 3)
print(summary(fit))
Objects exported from other packages
Description
These objects are imported from other packages. Follow the links below to see their documentation.
Resolve the weight argument
Description
NULL means "the Epanechnikov implied by one_sided", which is what every
call made before weight existed was asking for. Resolving it here rather
than as a default argument keeps that backward compatibility exact: a
literal default of w_epan_half() would silently turn
one_sided = FALSE into a one-sided fit, because the support would still
be [0, 1].
Usage
resolve_weight(weight, one_sided)
Arguments
weight |
A weight function, or |
one_sided |
Logical, used only when |
Value
A weight function.
Risk-set weights at the event times
Description
The risk-set averages S^{(k)} use the same kernel as the main term of
each estimating equation, so they are built from the same weight function
and the same one-sided rule, here, rather than rewritten in C++. Rows are
the distinct event times among the rows that contribute (delta == 1 and a
nonzero row weight), columns are the observation rows, and index maps
each data row to its row of K (0-based, -1 for a row that does not
contribute).
Usage
risk_set_weights(X_time, obs_times, delta, kerval, h, weight, one_sided)
Arguments
X_time, obs_times, delta |
Event times, observation times, event indicator. |
kerval |
Row weights from |
h, weight, one_sided |
As for |
Details
The matrix has one row per distinct event time, not per data row, because every row of a subject shares the subject's event time.
Value
A list with index (integer) and K (numeric matrix).
Simulate asynchronous longitudinal data
Description
Draw a sparse longitudinal response and a sparse longitudinal covariate whose
observation times are independent, so the two are never seen together.
This is the design of Cao, Zeng and Fine (2015), Section 4: response times and
covariate times are independent Poisson streams on (0, 1), the covariate
is a mean-zero Gaussian process, and the error is a second, independent
Gaussian process.
Usage
sim_async_data(
n,
beta = c(0.5, 1.5),
lambda_y = 5,
lambda_x = 5,
link = c("identity", "log", "logistic"),
x_cov = function(s, t) exp(-abs(s - t)),
e_cov = function(s, t) 2^(-abs(s - t))
)
Arguments
n |
Number of subjects. |
beta |
Either a numeric vector |
lambda_y, lambda_x |
Poisson rates for the response and covariate
observation streams on |
link |
One of |
x_cov, e_cov |
Covariance functions of two times, vectorised, for the covariate and error processes. |
Details
The default covariate covariance \exp(-|s - t|) is the Ornstein-
Uhlenbeck covariance. Its diagonal has a kink, so it is only one-sided
differentiable, which is exactly the case Cao, Zeng and Fine's Section 6
leaves open. Supply a smooth
x_cov, for instance function(s, t) exp(-(s - t)^2), to generate data
inside their stated assumptions instead.
beta may be a numeric vector, giving time-invariant coefficients suitable
for kee_async(), or a function of time returning one row per supplied time,
giving a coefficient curve suitable for kee_async_td(). In both cases the
first element is the intercept and the remaining p elements multiply the p
covariate coordinates.
Value
A list of two tibbles on different time grids:
- y
id,time,y– one row per response occasion.- x
id,time, and one column per covariate coordinate – namedxwhen there is a single covariate,x1,x2, ... otherwise. One row per covariate occasion, on a time grid independent ofy's.
References
Cao, H., Zeng, D. and Fine, J. P. (2015). Regression analysis of sparse asynchronous longitudinal data. Journal of the Royal Statistical Society, Series B 77, 755-776.
Examples
set.seed(1)
d <- sim_async_data(n = 50)
str(d)
# The two tables share `id` and nothing else; their `time` grids are
# independent draws, which is what makes the data asynchronous.
head(d$y, 3)
head(d$x, 3)
# A coefficient curve, for kee_async_td().
d2 <- sim_async_data(n = 50, beta = function(tt) cbind(0.5, 1 + tt))
Simulate Sparse Longitudinal Survival Data
Description
Simulate right-censored survival data with sparsely and intermittently observed longitudinal covariates under a transformed hazards model.
Usage
sim_skmle_data(n, mu, mu_bar, alpha, beta, s, cen, nstep = 20)
Arguments
n |
Number of subjects to simulate. |
mu |
Function giving the intensity of the observation-time process for the longitudinal covariates. |
mu_bar |
Numeric upper bound for |
alpha |
Function giving the baseline component of the transformed hazards model. |
beta |
Numeric vector of true regression coefficients. The current simulator
supports exactly two covariates, so |
s |
Box-Cox transformation parameter. Use |
cen |
Positive censoring parameter controlling the follow-up window. |
nstep |
Number of grid intervals used to generate the latent piecewise-constant time-varying covariate process. |
Details
The simulated data are returned in long format, with one row per subject-visit pair. Each row contains the observed event or censoring time, the event indicator, the observation time for the longitudinal covariate, and the covariate values observed at that visit.
The first covariate is generated as a latent step function over time. The second covariate is a binary subject-level indicator. Event times are generated by numerically inverting the cumulative transformed hazard, and observation times are generated from a non-homogeneous Poisson process.
Value
A tibble in long format with columns:
-
id: subject identifier. -
X: observed event or censoring time. -
delta: event indicator. -
covariates: a two-column matrix of observed covariates atobs_times. -
obs_times: longitudinal observation time. -
censoring: subject-specific censoring time.
Examples
set.seed(123)
sim_data <- sim_skmle_data(
n = 50,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
head(sim_data)
table(sim_data$delta)
# The `covariates` column is a matrix; use it directly in model formulas
# or split it into explicit columns if preferred.
sim_data$Z1 <- sim_data$covariates[, 1]
sim_data$Z2 <- sim_data$covariates[, 2]
head(sim_data[, c("id", "X", "delta", "obs_times", "Z1", "Z2")])
Fit a Transformed Hazards Model by SMKLE
Description
Fit a transformed hazards model for survival data with sparsely and intermittently observed longitudinal covariates using the sieve maximum kernel-weighted log-likelihood estimator (SMKLE).
Usage
skmle(
formula,
data,
id,
obs_times,
s = 0,
h = NULL,
nknots = 3,
lq_nodes = 64,
maxeval = 10000,
xtol_rel = 1e-06,
one_sided = TRUE,
weight = NULL,
optimizer = c("slsqp", "barrier")
)
Arguments
formula |
A model formula. The left-hand side must be a |
data |
Data frame containing the variables used in |
id |
Subject identifier. Non-numeric identifiers are allowed and are internally converted to integer subject codes. |
obs_times |
Longitudinal observation times aligned row-wise with |
s |
Box-Cox transformation parameter, defaulting to |
h |
Positive kernel bandwidth. If omitted, one is read off the
observation times as a rule of thumb and reported in a message. Use
|
nknots |
Number of interior knots used in the sieve approximation of the
baseline component. Knots are placed at |
lq_nodes |
Number of Legendre-Gauss quadrature nodes used in numerical integration. |
maxeval |
Maximum number of optimizer evaluations. |
xtol_rel |
Relative convergence tolerance passed to the optimizer. |
one_sided |
Logical. |
weight |
Weight function of the standardised lag |
optimizer |
|
Details
skmle() is the main model-fitting function in the package. It combines:
kernel weighting to handle intermittently observed longitudinal covariates,
a sieve approximation for the unknown baseline component, and
a C++-backed numerical optimizer for the joint estimation problem.
The returned object follows the usual R model pattern: print the fitted coefficients
with print(), obtain inferential output with summary(), and visualize the
estimated baseline component with plot().
Value
An object of class skmle containing:
-
coefficients: regression coefficient estimates, -
var: estimated variance-covariance matrix for the regression coefficients, -
gamma: estimated spline coefficients for the baseline component, -
loglik: maximized log-likelihood, -
convergence: optimizer status code, -
scores: per-subject contributions to the score for the coefficients (one row per subject), from which the sandwich'sBis formed, model metadata such as
n,s,h, andcall.
References
Sun, Dayu, Zhuowei Sun, Xingqiu Zhao, and Hongyuan Cao. "Kernel Meets Sieve: Transformed Hazards Models with Sparse Longitudinal Covariates." Journal of the American Statistical Association 120(552), 2580-2591. doi:10.1080/01621459.2025.2476781
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 80,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
fit <- skmle(
Surv(X, delta) ~ covariates,
data = dat,
id = id,
obs_times = obs_times,
s = 0,
h = 0.5,
nknots = 3
)
summary(fit)
Select the Bandwidth by Cross-Validation
Description
Perform K-fold cross-validation to select the kernel bandwidth for skmle().
Usage
skmle_cv(
formula,
data,
id,
obs_times,
s = 0,
K = 5,
h_grid = NULL,
n_h = 10,
nknots = 3,
lq_nodes = 64,
maxeval = 10000,
xtol_rel = 1e-06,
seed = NULL,
quiet = FALSE,
one_sided = TRUE,
weight = NULL
)
## S3 method for class 'cv.skmle'
print(x, ...)
Arguments
formula |
A model formula. The left-hand side must be a |
data |
Data frame containing the variables used in |
id |
Subject identifier. Non-numeric identifiers are allowed and are internally converted to integer subject codes. |
obs_times |
Longitudinal observation times aligned row-wise with |
s |
Box-Cox transformation parameter, defaulting to |
K |
Number of folds. |
h_grid |
Optional numeric vector of candidate bandwidth values. If |
n_h |
Number of candidate bandwidths to generate when |
nknots |
Number of interior knots used in the sieve approximation of the
baseline component. Knots are placed at |
lq_nodes |
Number of Legendre-Gauss quadrature nodes used in numerical integration. |
maxeval |
Maximum number of optimizer evaluations. |
xtol_rel |
Relative convergence tolerance passed to the optimizer. |
seed |
Optional integer seed for the random subject-to-fold assignment.
If |
quiet |
Logical; if |
one_sided |
Logical. |
weight |
Weight function of the standardised lag |
x |
A |
... |
Ignored. |
Value
An object of class cv.skmle with components:
-
h_cv: selected bandwidth, -
fit:skmlefit refit on the full data, -
cv_results: data frame of candidate bandwidths, their CV losses, and the standard error of each loss across the folds, -
h_grid: bandwidth grid used in the search, -
fold_id: the subject-to-fold assignment vector (lengthn), -
seed: the value ofseedsupplied by the user, orNULL, -
call: the matched call.
Kernel choice
one_sided is used inside the fold loop as well as being passed through to
the refit, so the bandwidth is selected under the same kernel the final fit
uses.
How the folds are formed
skmle_cv() splits subjects across folds. Several rows belong to the same
subject in long format, so splitting by row would put one subject on both
sides of the split.
After choosing the bandwidth with the smallest average validation loss, the
function refits skmle() on the full data set using the selected value.
Because the fold assignment is random, pass seed (or set.seed() before
calling) to make the grid selection reproducible.
The loss
Each training fold is fitted at the candidate bandwidth, and the fit is scored on the held-out subjects by the log-likelihood per subject,
-\frac{1}{n_{\mathrm{test}}} \sum_{i \in \mathrm{test}}
\left[ \delta_i \log g\{\hat\alpha(X_i) + Z_i(X_i)^\top \hat\beta\}
- \int_0^{X_i} g\{\hat\alpha(t) + Z_i(t)^\top \hat\beta\}\,dt \right],
where Z_i(t) is the covariate carried forward from the last observation
at or before t. This loss does not depend on the bandwidth itself, so
it compares candidates on an equal footing.
The grid
When h_grid is NULL the grid is log-spaced over
[\max\{\min_i (X_i - T_{ij})_+,\ \tau n^{-0.6}\},\
\min\{\max_i \max_j (X_i - T_{ij})_+,\ \tau n^{-0.3}\}], with
\tau = \max_i X_i, so it adapts to the scale of the times on its own.
If the selected value is an endpoint of the grid, skmle_cv() warns; supply
a wider h_grid.
cv_results lists the loss and its standard error across folds for every
candidate.
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 60,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
cv_fit <- skmle_cv(
Surv(X, delta) ~ covariates,
data = dat,
id = id,
obs_times = obs_times,
s = 0,
K = 3,
seed = 2026,
quiet = TRUE
)
cv_fit$h_cv
# Read the whole table, not just the selection: a minimum on the edge of the
# grid is a boundary artefact and warns.
cv_fit$cv_results
summary(cv_fit$fit)
Summary for kee object
Description
Summary for kee object
Usage
## S3 method for class 'kee'
summary(object, ...)
Arguments
object |
An object of class |
... |
Further arguments passed to or from other methods. |
Value
An object of class summary.kee containing the call,
a coefficient table with estimates, standard errors, z-statistics
and p-values, the convergence code, and the sample size n.
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 60,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
fit <- kee_cox(Surv(X, delta) ~ covariates, data = dat, id = id,
obs_times = obs_times, h = 0.5)
summary(fit)
Summary for skmle object
Description
Summary for skmle object
Usage
## S3 method for class 'skmle'
summary(object, ...)
Arguments
object |
An object of class |
... |
Further arguments passed to or from other methods. |
Value
An object of class summary.skmle containing the call,
a coefficient table with estimates, standard errors, z-statistics
and p-values, the log-likelihood, convergence status, and the sample
size n.
Examples
library(survival)
set.seed(123)
dat <- sim_skmle_data(
n = 60,
mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
mu_bar = 8,
alpha = function(tt) 0.5 * 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
beta = c(1, -0.5),
s = 0,
cen = 0.7
)
fit <- skmle(Surv(X, delta) ~ covariates, data = dat, id = id,
obs_times = obs_times, s = 0, h = 0.5, nknots = 3)
summary(fit)
Summarise a fit as a tibble
Description
One row per coefficient for skmle and kee fits, and one row per
(target time, coefficient) for kee_td, so a coefficient curve goes
straight into ggplot2 without reshaping.
Usage
## S3 method for class 'skmle'
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
## S3 method for class 'kee'
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
## S3 method for class 'kee_td'
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
Arguments
x |
A fitted |
conf.int |
Logical, add |
conf.level |
Confidence level for those columns. |
... |
Unused. |
Value
A tibble with columns term, estimate, std.error, statistic
and p.value, preceded by time for a kee_td fit, and followed by
conf.low and conf.high when conf.int = TRUE.
Examples
set.seed(1)
d <- sim_async_data(n = 150)
fit <- kee_async(d$y, d$x, y ~ x, id = id, time = time, h = 0.3)
tidy(fit, conf.int = TRUE)
Extract the covariance matrix of a fitted model
Description
Extract the covariance matrix of a fitted model
Usage
## S3 method for class 'skmle'
vcov(object, ...)
## S3 method for class 'kee'
vcov(object, ...)
## S3 method for class 'kee_td'
vcov(object, time = NULL, ...)
Arguments
object |
A fitted |
... |
Unused. |
time |
For a |
Value
For skmle and kee, the estimated covariance matrix of the
regression coefficients. For kee_td, see time.
Examples
set.seed(1)
d <- sim_async_data(n = 120)
fit <- kee_async(d$y, d$x, y ~ x, id = id, time = time, h = 0.3)
vcov(fit)
The support of a weight, with a conservative fallback
Description
The support of a weight, with a conservative fallback
Usage
weight_support(weight)
Arguments
weight |
A weight function. |
Value
Length-2 numeric.