lp {rsurv}R Documentation

Linear predictors

Description

Function to construct linear predictors.

Usage

lp(formula, coefs, data, ...)

Arguments

formula

formula specifying the linear predictors.

coefs

vector of regression coefficients.

data

data frame containing the covariates used to construct the linear predictors.

...

further arguments passed to other methods.

Value

a vector containing the linear predictors

Examples


library(rsurv)

n <- 100
coefs <- c(1, 0.7, 2.3)

simdata <- data.frame(
  age = rnorm(n),
  sex = sample(c("male", "female"), size = n, replace = TRUE)
) |>
  mutate(
    lp = lp(~age+sex, coefs)
  )
glimpse(simdata)



[Package rsurv version 0.0.1 Index]