robincar_glm.Rd
Estimate treatment-group-specific response means and (optionally) treatment group contrasts using a generalized linear working model.
robincar_glm(
df,
treat_col,
response_col,
formula = NULL,
car_strata_cols = NULL,
car_scheme = "simple",
g_family = stats::gaussian,
g_accuracy = 7,
contrast_h = NULL,
contrast_dh = NULL
)
A data.frame with the required columns
Name of column in df with treatment variable
Name of the column in df with response variable
The formula to use for adjustment specified using as.formula("..."). This overrides car_strata_cols and covariate_cols.
Names of columns in df with car_strata variables
Name of the type of covariate-adaptive randomization scheme. One of: "simple", "pocock-simon", "biased-coin", "permuted-block".
Family that would be supplied to glm(...), e.g., binomial. If no link specified, will use default link, like behavior in glm. If you wish to use a negative binomial working model with an unknown dispersion parameter, then use `g_family="nb"`.
Level of accuracy to check prediction un-biasedness.
An optional function to specify a desired contrast
An optional jacobian function for the contrast (otherwise use numerical derivative)
If `contrast_h` argument is used, outputs a `main` and a `contrast` object. The `main` object has the following structure:
A dplyr::tibble() with the treatment label, treatment mean estimate using AIPW, estimated SE, and p-value based on a z-test with estimate and SE.
The variance-covariance matrix for the treatment mean estimates.
List of model settings used in covariate adjustment.
The original dataset provided by the user.
The fit from the glm() working model used for covariate adjustment.
Predicted potential outcomes for each treatment category (columns) and individual (rows). These are the \(\hat{\mu}_a\)
.
The G-computation estimate based only on \(\frac{1}{n} \sum_{i=1}^{n} \hat{\mu}_a(X_i)\). This is equivalent to the AIPW estimate when a canonical link function is used.
Attributes about the dataset.
The `contrast` object has a structure that is documented in RobinCar::robincar_contrast().
The output is the AIPW estimator given by (for each treatment group \(a\)):
$$\frac{1}{n} \sum_{i=1}^{n} \hat{\mu}_a(X_i) + \frac{1}{n_a} \sum_{i:A_i=a} \{Y_i - \hat{\mu}(X_i)\}$$
where \(Y_i\) is the outcome, \(A_i\) is the treatment assignment, \(X_i\) are the covariates, \(n_a = \sum_{i=1}^{n} A_i=a\), and \(\hat{\mu}_a\) is the estimated conditional mean function based on the GLM working model. This working model has treatment \(a\)-specific coefficients if `adj_method` is "heterogeneous". Otherwise, they are shared across the treatment arms. Alternatively, if `formula` is used, the working model can be specified according to the user.
Importantly, the estimated variance accounts for misspecification of the working model, and for covariate-adaptive randomization.