lp | R Documentation |
Function to construct linear predictors.
lp(formula, coefs, data, ...)
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. |
a vector containing the linear predictors.
library(rsurv)
library(dplyr)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.