data_modelling.Rd
Sets up the model formulas and data for the pooled logistic regression and robust variance estimation and fits the models.
data_modelling(
data,
outcome_cov = ~1,
model_var = NULL,
first_followup = NA,
last_followup = NA,
use_weight = FALSE,
analysis_weights = c("asis", "unweighted", "p99", "weight_limits"),
weight_limits = c(0, Inf),
use_censor = FALSE,
include_followup_time = ~followup_time + I(followup_time^2),
include_expansion_time = ~for_period + I(for_period^2),
where_case = NA,
glm_function = c("glm", "parglm"),
use_sample_weights = TRUE,
quiet = FALSE,
...
)
A data.frame
containing all the required columns.
A RHS formula with baseline covariates to adjust in final model
List of Variables of interest to be used in final model.
Derived variables to use in outcome models. Typically assigned_treatment
for ITT and per-protocol,
and dose + dose^2
for as-treated.
First follow-up period
Last follow-up period
Use weights in analysis. If FALSE
then no weights will be calculated.
One of
"asis"
: use the weights as calculated
"p99"
: truncate weights at the 1st and 99th percentiles
"weight_limits"
: truncate weights at the values specified in weight_limits
"unweighted"
: set all analysis weights to 1, even with use_weight = TRUE
Lower and upper limits to truncate weights, given as c(lower, upper)
Use censoring for per-protocol analysis - censor person-times once a person-trial stops taking the initial treatment value
The model to include the follow up time of the trial (followup_time
) in outcome model,
specified as a RHS formula.
The model to include the trial period (for_period
) in outcome model,
specified as a RHS formula.
List of where conditions used in subsetting the data used in final analysis
Which glm function to use for the final model from stats
or parglm
packages
Use sample weights in addition to IP weights. data
must contain a column sample_weight
.
The weights used in the model are calculated as weight = weight * sample_weight
.
Don't print progress messages.
Additional arguments passed to glm_function
. This may be used to specify initial parameter estimates
or arguments to control
. See stats::glm, parglm::parglm and parglm::parglm.control()
for more information.
Object of class TE_model
containing
model
, a glm
object
robust
a list containing a coefficient summary table and the robust covariance matrix
.
The class variables parameters (outcomeClass
,class_switchn
,
class_switchd
,class_censen
,class_censed
) can be given as a character
vector which will construct factors using as.factor
or as a named list
with the arguments for factor e.g.
list(risk_cat=list(levels = c(1,2,3,0), age_cat=list(levels=c(1,2,3),labels=c("50-60","60-70","70+")