Learn R Programming

cofad (version 0.3.2)

lambda_diff: Calculate lambdas for two competing hypotheses

Description

If you want to test two competing hypotheses, you can use this helper function to create the correct difference lambdas. There is no magic here. The two contrasts are z-standardized first and then subtracted (lambda_preferred - lambda_competing). You can use the new difference lambdas as the input for calc_contrast.

Usage

lambda_diff(lambda_preferred, lambda_competing, labels = NULL)

Value

Lambdas for difference between lambda_preferred and lambda_competing

Arguments

lambda_preferred

Lambdas of the preferred hypothesis. Has to be a named vector with the names corresponding with the groups in the analyzed data set. Alternatively, use the parameter labels.

lambda_competing

Lambdas of the competing hypothesis. Has to be a named vector with the names corresponding with the groups in the analyzed data set. Alternatively, use the parameter labels.

labels

If you provide lambdas without names, you can set the group labels for both contrasts here.

Examples

Run this code
lambda <- lambda_diff(c("A" = 1, "B" = 2, "C" = 3),
                      c("A" = 1, "B" = 2, "C" = 6))
lambda
# same result
lambda2 <- lambda_diff(c(1, 2, 3), c(1, 2, 6),
                       labels = c("A", "B", "C"))
lambda2

Run the code above in your browser using DataLab