View source: R/generateNonHomogeneousExp.R
rate_t | R Documentation |
This function calculates the rate at a specific time point for a non-homogeneous process, based on a set of covariates and their corresponding parameters. The rate can be computed either as a linear combination of the parameters and covariates or as an exponential of this linear combination.
rate_t(t, params, cov_funcs, use_exponential = FALSE)
t |
Numeric, the time at which the rate is to be calculated. |
params |
Numeric vector, parameters for the rate function including the baseline rate. |
cov_funcs |
List of functions, each representing a covariate as a function of time. |
use_exponential |
Logical, if TRUE, the exponential of the linear combination is returned, otherwise, the linear combination itself is returned. |
Numeric, the calculated rate at time 't'.
# Define example covariate functions
cov_func1 <- function(t) { sin(t) }
cov_func2 <- function(t) { cos(t) }
# Example parameters (baseline and coefficients for covariates)
params <- c(0.5, 1.2, -0.8)
# Compute the rate at a specific time
rate_at_time_5 <- rate_t(t = 5, params = params,
cov_funcs = list(cov_func1, cov_func2),
use_exponential = TRUE)
print(rate_at_time_5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.