Skip to contents

Contrast Functions and Jacobians

Create Contrast of Pairs

Usage

h_diff(x, y)

h_jac_diff(x, y)

h_ratio(x, y)

h_jac_ratio(x, y)

h_odds_ratio(x, y)

h_jac_odds_ratio(x, y)

eff_jacob(f)

pairwise(levels, x = levels)

against_ref(levels, ref = levels[1], x = tail(levels, -1))

custom_contrast(levels, x, y)

Arguments

x

(vector) A vector of treatment levels.

y

(vector) A vector of treatment levels.

f

(function) Function with argument x and y to compute treatment effect.

levels

(character) Levels of the treatment.

ref

(string or int) Reference level.

Value

Vector of contrasts, or matrix of jacobians.

Examples

h_diff(1:3, 4:6)
#> [1] -3 -3 -3
h_jac_ratio(1:3, 4:6)
#>           [,1]        [,2]
#> [1,] 0.2500000 -0.06250000
#> [2,] 0.2000000 -0.08000000
#> [3,] 0.1666667 -0.08333333