create_input_mats() is a generic function for creating an object of class input_mats. Model matrices are constructed based on the variables specified in the model object and the data specified in input_data. create_input_mats() is not typically called by users directly, but is instead used by functions that create model objects (e.g., create_IndivCtstmTrans(), create_CohortDtstmTrans(), create_PsmCurves()).
create_input_mats(object,...)## S3 method for class 'lm'create_input_mats(object, input_data,...)## S3 method for class 'flexsurvreg'create_input_mats(object, input_data,...)## S3 method for class 'flexsurvreg_list'create_input_mats(object, input_data,...)## S3 method for class 'partsurvfit'create_input_mats(object, input_data,...)## S3 method for class 'params_lm'create_input_mats(object, input_data,...)## S3 method for class 'params_surv'create_input_mats(object, input_data,...)## S3 method for class 'params_surv_list'create_input_mats(object, input_data,...)## S3 method for class 'multinom'create_input_mats(object, input_data,...)## S3 method for class 'multinom_list'create_input_mats(object, input_data,...)## S3 method for class 'params_mlogit_list'create_input_mats(object, input_data,...)
Arguments
object: An object of the appropriate class.
...: Further arguments passed to model.matrix().
input_data: An object of class expanded_hesim_data returned by expand.hesim_data(). It is used to look for the variables needed to create an input matrix for use in a statistical models and the ID variables for indexing rows in the input matrix.
Returns
An object of class input_mats.
Examples
library("flexsurv")strategies <- data.frame(strategy_id = c(1,2))patients <- data.frame(patient_id = seq(1,3), age = c(45,47,60), female = c(1,0,0), group = factor(c("Good","Medium","Poor")))states <- data.frame(state_id = seq(1,3), state_name = factor(paste0("state", seq(1,3))))hesim_dat <- hesim_data(strategies = strategies, patients = patients, states = states)# Class "lm"input_data <- expand(hesim_dat, by = c("strategies","patients","states"))medcost_fit <- lm(costs ~ female + state_name, psm4_exdata$costs$medical)input_mats <- create_input_mats(medcost_fit, input_data)input_mats
# Class "flexsurvreg"input_data <- expand(hesim_dat, by = c("strategies","patients"))fit_wei <- flexsurvreg(formula = Surv(futime, fustat)~1, data = ovarian, dist ="weibull")input_mats <- create_input_mats(fit_wei, input_data)input_mats