Covariate adjusted glm model
Arguments
- formula
(
formula
) A formula of analysis.- data
(
data.frame
) Input data frame.- treatment
(
formula
orcharacter(1)
) A formula of treatment assignment or assignment by stratification, or a string name of treatment assignment.- contrast
(
function
orcharacter(1)
) A function to calculate the treatment effect, or character of "difference", "risk_ratio", "odds_ratio" for default contrasts.- contrast_jac
(
function
) A function to calculate the Jacobian of the contrast function. Ignored if using default contrasts.- vcov
(
function
) A function to calculate the variance-covariance matrix of the treatment effect, includingvcovHC
andgvcov
.- family
(
family
) A family object of the glm model.- vcov_args
(
list
) Additional arguments passed tovcov
.- ...
Additional arguments passed to
glm
orglm.nb
.
Details
If family is MASS::negative.binomial(NA)
, the function will use MASS::glm.nb
instead of glm
.
Examples
robin_glm(
y ~ treatment * s1,
data = dummy_data,
treatment = treatment ~ s1, contrast = "difference"
)
#> Treatment Effect
#> -------------
#> Model : y ~ treatment * s1
#> Randomization: treatment ~ s1
#> Marginal Mean:
#> counter-factual prediction
#>
#> pbo trt1 trt2
#> 0.2230481 0.7639923 0.9482753
#>
#> Variance Type: gvcov
#> Estimate Std.Err Z Value Pr(>|z|)
#> trt1 - pbo 0.541 0.103 5.26 1.4e-07 ***
#> trt2 - pbo 0.725 0.103 7.04 1.9e-12 ***
#> trt2 - trt1 0.184 0.109 1.69 0.091 .
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1