cv_loglik_p: Cross-validated observed-data log-likelihood for B-spline...

Description Usage Arguments Value

View source: R/cv_loglik_p.R

Description

Cross-validated observed-data log-likelihood for B-spline coefficients

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
cv_loglik_p(
  nfold = 5,
  interp = FALSE,
  seed = NULL,
  time,
  event,
  covar = NULL,
  bspline,
  data,
  tol = 1e-04,
  max_iter = 1000,
  assume_last = FALSE
)

Arguments

interp

Indicator of whether the B-spline coefficients in the testing data should be linearly interpolated from the trained model. Defaults to FALSE.

seed

(Optional) For reproducibility in assigning the folds, an integer to specify the random number generator. Default is NULL.

time

Column name for follow-up time

event

Column name for event indicators

covar

(Optional) column name(s) for additional fully-observed covariates. Default is NULL, which estimates unconditional survival.

bspline

Column names for B-spline basis.

data

Dataframe or matrix containing (at least) named columns time, event, covar, and bspline.

tol

Tolerance to define convergence. Default is 1E-4.

max_iter

Maximum number of iterations allowed for the EM algorithm. Default is 1000.

assume_last

Assume last observed time is an event (for use when the integration of the survival function is desired). Default is FALSE.

nfolds

Specifies the number of cross-validation folds. The default value is 5. Although nfolds can be as large as the sample size (leave-one-out cross-validation), it is not recommended for large datasets. The smallest value allowable is 3.

Value

avg_pred_loglik

Stores the average predicted log likelihood.

pred_loglik

Stores the predicted log likelihoood in each fold.

converged

Stores the convergence status of the EM algorithm in each run.


sarahlotspeich/sieveSurv documentation built on Feb. 14, 2022, 5:10 a.m.