rate_t: Compute the Rate at a Given Time for a Non-Homogeneous...

View source: R/generateNonHomogeneousExp.R

rate_tR Documentation

Compute the Rate at a Given Time for a Non-Homogeneous Process

Description

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.

Usage

rate_t(t, params, cov_funcs, use_exponential = FALSE)

Arguments

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.

Value

Numeric, the calculated rate at time 't'.

Examples

# 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)


franciscorichter/emphasis documentation built on Feb. 19, 2024, 7:36 p.m.