dynamichazard (version 0.5.1)

static_glm: Static glm fit

Description

Method to fit a static model corresponding to a ddhazard fit. The method uses weights to ease the memory requirements. See get_survival_case_weights_and_data for details on weights.

Usage

static_glm(formula, data, by, max_T, ..., id, family = "logit", model = F,
  weights, risk_obj = NULL, speedglm = F, only_coef = FALSE, mf,
  method_use = c("glm", "speedglm", "parallelglm"),
  n_threads = getOption("ddhazard_max_threads"))

Arguments

formula

coxph like formula with Surv(tstart, tstop, event) on the left hand site of ~.

data

data.frame or environment containing the outcome and co-variates.

by

interval length of the bins in which parameters are fixed.

max_T

end of the last interval interval.

...

arguments passed to glm or speedglm. If only_coef = TRUE then the arguments are passed to glm.control if glm is used.

id

vector of ids for each row of the in the design matrix.

family

"logit" or "exponential" for a static equivalent model of ddhazard.

model

TRUE if you want to save the design matrix used in glm.

weights

weights to use if e.g. a skewed sample is used.

risk_obj

a pre-computed result from a get_risk_obj. Will be used to skip some computations.

speedglm

depreciated.

only_coef

TRUE if only coefficients should be returned. This will only call the speedglm.wfit or glm.fit which will be faster.

mf

model matrix for regression. Needed when only_coef = TRUE

method_use

method to use for estimation. glm uses glm.fit, speedglm uses speedglm.wfit and parallelglm uses a parallel C++ version glm.fit which only gives the coefficients.

n_threads

number of threads to use when method_use is "parallelglm".

Value

The returned list from the glm call or just coefficients depending on the value of only_coef.

Examples

Run this code
# NOT RUN {
library(dynamichazard)
fit <- static_glm(
 Surv(time, status == 2) ~ log(bili), pbc, id = pbc$id, max_T = 3600,
 by = 50)
fit$coefficients

# }

Run the code above in your browser using DataCamp Workspace