estimate_contrast {glmglrt}R Documentation

Point estimates of contrasts

Description

This S3 generic function allows the computation of point estimates of contrasts (i.e. linear combinations) of fixed-effects in many models The default implementation computes Wald's confidence intervals with any model as long as it implements fixcoef, returning a vector of fixed effects.

Usage

estimate_contrast(model, contrast, method = NULL, ...)

## Default S3 method:
estimate_contrast(model, contrast, method = NULL, ...)

Arguments

model

a fitted statistical model such as a glm or a coxph.

contrast

numeric vector of the same length as the number of coefficients in the model; it describes the contrast sum(contrast*fixcoef(model)).

method

character string value; specification of the algorithm used (implementation dependent). NULL must be accepted. Suggested values are "ML" for maximum-likelihood, "REML" for restricted maximum-likelihood and "OLS" for ordinary least squares.

...

Additional parameters that may be used by some implementations.

Details

This function should consistent with confint_contrast and p_value_contrast as they are designed to be used together. If a null hypothesis (H0) is specified, it MUST be ignored by estimate_contrast. If you want to make it consistent with p_value_contrast you may substract H0 from the output of estimate_contrast and confint_contrast.

Value

A single numeric value (vector of length 1) equal to the point estimate of the contrast, with the name "pvalue".

Methods (by class)

See Also

Other Contrast functions: confint_contrast(), estimate_confint_contrast(), p_value_contrast()

Examples

data(mtcars)
model1 = glm(family="gaussian", data=mtcars, hp ~ 0+factor(gear))
# do cars with 5 gears have more horse power (hp) than cars with 4 gears ?
estimate_contrast(model1, c(0,-1,1))

# now, we fit an equivalent model (same distribution and same predictions)
model2 = glm(family=gaussian(log), data=mtcars, hp ~ 0+factor(gear))

# do cars with 5 gears have at least twice the horse power than cars with 4 gears ?

estimate_contrast(model1, c(0,-1,0.5))


[Package glmglrt version 0.2.2 Index]