fit_contrasts: Fit Contrasts for Linear Model

View source: R/con_stats.R

fit_contrastsR Documentation

Fit Contrasts for Linear Model

Description

This function calculates contrasts for a fitted linear model.

Usage

fit_contrasts(lmfit, conmat, colind, se = TRUE)

Arguments

lmfit

The fitted linear model object.

conmat

The contrast matrix or contrast vector.

colind

The subset column indices in the design associated with the contrast.

se

Whether to compute standard errors, t-statistics, and p-values (default: TRUE).

Value

A list containing the following elements:

  • conmat: Contrast matrix.

  • sigma: Residual standard error.

  • df.residual: Degrees of freedom for residuals.

  • estimate: Estimated contrasts.

  • se: Standard errors of the contrasts (if se = TRUE).

  • stat: t-statistics for the contrasts (if se = TRUE).

  • prob: Probabilities associated with the t-statistics (if se = TRUE).

  • stat_type: Type of the statistics calculated.

Examples

data(mtcars)
lm_fit <- lm(mpg ~ wt + qsec + am, data = mtcars)
contrast_matrix <- matrix(c(0, -1, 1), nrow = 1, byrow = TRUE)
fit_contrasts(lm_fit, contrast_matrix, c(2, 3))

bbuchsbaum/fmrireg documentation built on May 16, 2023, 10:56 a.m.