n_models: Gets the dimension of 'fixest_multi' objects

View source: R/fixest_multi.R

n_modelsR Documentation

Gets the dimension of fixest_multi objects

Description

Otabin the number of unique models of a fixest_multi object, depending on the type requested.

Usage

n_models(
  x,
  lhs = FALSE,
  rhs = FALSE,
  sample = FALSE,
  fixef = FALSE,
  iv = FALSE
)

Arguments

x

A fixest_mutli object, obtained e.g. from feols.

lhs

Logical scalar, default is FALSE. If TRUE, the number of different left hand sides is returned.

rhs

Logical scalar, default is FALSE. If TRUE, the number of different right hand sides is returned.

sample

Logical scalar, default is FALSE. If TRUE, the number of different samples is returned.

fixef

Logical scalar, default is FALSE. If TRUE, the number of different types of fixed-effects is returned.

iv

Logical scalar, default is FALSE. If TRUE, the number of different IV stages is returned.

Value

It returns an integer scalar. If no argument is provided, the total number of models is returned.

See Also

Multiple estimations in feols, models

Examples


base = setNames(iris, c("y", "x1", "x2", "x3", "species"))
est = feols(y ~ csw(x1, x2, x3), base, fsplit = ~species)

# there are 3 different RHSs and 4 different samples
models(est)

# We can obtain these numbers with n_models
n_models(est, rhs = TRUE)
n_models(est, sample = TRUE)



fixest documentation built on June 22, 2024, 9:12 a.m.