Learn R Programming

dynamichazard (version 1.0.2)

ddFixed: Auxiliary Functions for Fixed Effects

Description

Functions used in formula of ddhazard for time-invariant effects. ddFixed_intercept is only used for the intercept.

Usage

ddFixed(object)

ddFixed_intercept(random_intercept = FALSE)

Value

Returns the passed object.

Arguments

object

expression that would be used in formula. E.g. x or poly(x, degree = 3).

random_intercept

TRUE if a zero mean time-varying process should be included at as an additional term. Only relevant in stationary models. See the type argument in PF_EM.

Examples

Run this code
# we can get a time-invariant effect of `x1` by
set.seed(1)
dat <- data.frame(stop = 1:20, event = rep(c(TRUE, FALSE), 10L), x1 = rnorm(20))
ddhazard(Surv(stop, event) ~ ddFixed(x1), dat,
         Q_0 = diag(1), by = 1, Q = diag(1))

# all of the calls below will yield the same result with a time-invariant
# intercept:
ddhazard(Surv(stop, event) ~ ddFixed_intercept() + x1, dat,
         Q_0 = diag(1), by = 1, Q = diag(1))
ddhazard(Surv(stop, event) ~ -1 + ddFixed_intercept() + x1, dat,
         Q_0 = diag(1), by = 1, Q = diag(1))

Run the code above in your browser using DataLab