Does the ANCOVA analysis, separately for each visit.
Arguments
- vars
(named
listofstringorcharacter)
specifying the variables in theANCOVAanalysis. The following elements need to be included as character vectors and match corresponding columns indata:response: the response variable.covariates: the additional covariate terms (might also include interactions).id: the subject ID variable (not really needed for the computations but for internal logistics).arm: the treatment group variable (factor).visit: the visit variable (factor).
Note that the
armvariable is by default included in the model, thus should not be part ofcovariates.- data
(
data.frame)
with all the variables specified invars. Records with missing values in any independent variables will be excluded.- conf_level
(
proportion)
confidence level of the interval.- weights_emmeans
(
string)
argument fromemmeans::emmeans(),'counterfactual'by default.
Value
A tern_model object which is a list with model results:
fit: A list with a fittedstats::lm()result for each visit.mse: Mean squared error, i.e. variance estimate, for each visit.df: Degrees of freedom for the variance estimate for each visit.lsmeans: This is a list with data framesestimatesandcontrasts. The attributeweightssavse the settings used (weights_emmeans).vars: The variable list.labels: Corresponding list with variable labels extracted fromdata.ref_level: The reference level for the arm variable, which is always the first level.treatment_levels: The treatment levels for the arm variable.conf_level: The confidence level which was used to construct thelsmeansconfidence intervals.
