mfa: Multivariate Factor Effects

Description Usage Arguments Details Value Author(s) Examples

Description

mfa handles the evaluation of multivariate factor effects with two behaviours. It evaluates the multivariate effects applied to the replicated factor x if size == NULL or simulates the replicated factor x if size is provided.

Usage

1
mfa(x, beta, levels = 1:nrow(beta), size = NULL)

Arguments

x

A replicated covariate factor of length nq to evaluate the multivariate effects. It is a q times replicated vector of x*. If size != NULL, x is the output of the function.

beta

A kxq matrix B of regression coefficients representing the effects for each level of x on the response variables. Each column represents the effect to each response variable.

levels

A character vector of length k to name the levels of the factor x.

size

A numeric value n representing the number of units, it is used to simulate the covariate x. In case size == NULL, mfa evaluates the effects.

Details

Considering x* the n-length factor under study with k levels and X the associated nxk design matrix with dummy variables corresponding to each level of the factor, the returning multivariate effect is

vec(XB),

where B is a kxq matrix of regression coefficients and vec(.) represents a vectorization by columns of the provided matrix.

Value

A simulated replicated factor x in case size is provided; otherwise, a nq-length numeric vector of the evaluated multivariate effects.

Author(s)

Erick A. Chacón-Montalván

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Different effects for each response.
(x <- mfa(beta = cbind(1:2, 2:3, 0:1), levels = c("F", "M"), size = 10))
mfa(x, beta = cbind(1:2, 2:3, 0:1))

# Same effects for each response.
(x <- mfa(beta = replicate(3, 0:2), size = 10))
mfa(x, beta = replicate(3, 0:2))

# Differrent intercepts for each response.
(x <- mfa(beta = cbind(1, 2, 0), size = 10))
mfa(x, beta = cbind(1, 2, 0))

ErickChacon/datasim documentation built on March 25, 2020, 7:53 p.m.