ypbp {YPBP}R Documentation

Fits the Yang and Prentice using Bernstein polynomials to model the baseline distribution.

Description

Fits the Yang and Prentice model with either the baseline hazard hazard or the baseline odds modeled via Bernstein polynomials.

Usage

ypbp(
  formula,
  data,
  degree = NULL,
  tau = NULL,
  approach = c("mle", "bayes"),
  baseline = c("hazard", "odds"),
  hessian = TRUE,
  hyper_parms = list(h1_gamma = 0, h2_gamma = 4, mu_psi = 0, sigma_psi = 4, mu_phi = 0,
    sigma_phi = 4, mu_beta = 0, sigma_beta = 4),
  ...
)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which ypbp is called.

degree

number of intervals of the PE distribution. If NULL, default value (square root of n) is used.

tau

the maximum time of follow-up. If NULL, tau = max(time), where time is the vector of observed survival times.

approach

approach to be used to fit the model (mle: maximum likelihood; bayes: Bayesian approach).

baseline

baseline function to be modeled.

hessian

logical; If TRUE (default), the hessian matrix is returned when approach="mle".

hyper_parms

a list containing the hyper-parameters of the prior distributions (when approach = "bayes"). If not specified, default values are used.

...

Arguments passed to either 'rstan::optimizing' or 'rstan::sampling' .

Value

ypbp returns an object of class "ypbp" containing the fitted model.

Examples


library(YPBP)
mle1 <- ypbp(Surv(time, status)~trt, data=gastric, baseline = "hazard")
mle2 <- ypbp(Surv(time, status)~trt, data=gastric, baseline = "odds")
bayes1 <- ypbp(Surv(time, status)~trt, data=gastric, baseline = "hazard",
               approach = "bayes", chains = 2, iter = 500)
bayes2 <- ypbp(Surv(time, status)~trt, data=gastric, baseline = "odds",
               approach = "bayes", chains = 2, iter = 500)




[Package YPBP version 0.0.1 Index]