fa: Univariate factor effects

Description Usage Arguments Details Value Author(s) Examples

Description

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

Usage

1
fa(x, beta, levels = 1:length(beta), size = NULL)

Arguments

x

A factor of length n to evaluate the effects. If size != NULL, x is the output of the function.

beta

A numeric vector b of regression coefficients representing the effects for each level of x.

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, fa 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 effect is

Xb,

where b is a k-length vector of regression coefficients.

Value

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

Author(s)

Erick A. Chacón-Montalván

Examples

1
2
3
(x <- fa(beta = -1:1, size = 10))
fa(x, beta = -1:1)
fa(x, beta = 1:3)

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