static_glm | R Documentation |
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.
The parallelglm_quick
and parallelglm_QR
methods are similar
to two methods used in bam
function in the mgcv
package (see
the `use.chol`
argument or Wood et al. 2015). parallelglm_QR
is more stable but slower. See Golub (2013) section 5.3 for a comparison of
the Cholesky decomposition method and the QR method.
static_glm( formula, data, by, max_T, ..., id, family = "logit", model = FALSE, weights, risk_obj = NULL, speedglm = FALSE, only_coef = FALSE, mf, method_use = c("glm", "speedglm", "parallelglm_quick", "parallelglm_QR"), n_threads = getOption("ddhazard_max_threads") )
formula |
|
data |
|
by |
interval length of the bins in which parameters are fixed. |
max_T |
end of the last interval interval. |
... |
arguments passed to |
id |
vector of ids for each row of the in the design matrix. |
family |
|
model |
|
weights |
weights to use if e.g. a skewed sample is used. |
risk_obj |
a pre-computed result from a |
speedglm |
depreciated. |
only_coef |
|
mf |
model matrix for regression. Needed when |
method_use |
method to use for estimation. |
n_threads |
number of threads to use when |
The returned list from the glm
call or just coefficients depending on the value of only_coef
.
Wood, S.N., Goude, Y. & Shaw S. (2015) Generalized additive models for large datasets. Journal of the Royal Statistical Society, Series C 64(1): 139-155.
Golub, G. H., & Van Loan, C. F. (2013). Matrix computations (4th ed.). JHU Press.
library(dynamichazard) fit <- static_glm( Surv(time, status == 2) ~ log(bili), pbc, id = pbc$id, max_T = 3600, by = 50) fit$coefficients
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.