EconPapers    
Economics at your fingertips  
 

FVGEN: Stata module to flatten factor-variable interactions into labeled main-effect and product variables

Timothy P Copeland ()
Additional contact information
Timothy P Copeland: Karolinska Institutet

Statistical Software Components from Boston College Department of Economics

Abstract: fvgen expands a factor-variable interaction specification, such as i.sex##c.age, into ordinary variables: an indicator for each categorical level (the base level dropped by default) and a product variable for each interaction term, with variable labels built from value labels so that a model fitted on the flattened variables exports as one clean, self-labeled row per coefficient. The flattened model is an exact reparameterization of the native factor-variable model. Options set per-factor reference levels (ref()), materialize every level, mean-center continuous terms before forming products, produce per-group slopes within levels of a variable (simple()), append the base level to main-effect labels, control the name prefix and the interaction label symbol, replace colliding variables, and drop all generated variables. The margins option refits the model with native factor syntax so that margins can be used, optionally storing the clone. Results returned in r() include the effective specification, the counts and names of main-effect, interaction, and generated variables, and the variables ordered for estimation.

Language: Stata
Requires: Stata version 16
Keywords: factor variables; interactions; indicator variables; dummy variables; value labels; variable labels; regression tables; export; margins (search for similar items in EconPapers)
Date: 2026-10-30
Note: This module should be installed from within Stata by typing "ssc install fvgen". The module is made available under terms of the MIT license (https://opensource.org/licenses/MIT).
References: Add references at CitEc
Citations:

Downloads: (external link)
http://fmwww.bc.edu/repec/bocode/f/fvgen.ado program code (text/plain)
http://fmwww.bc.edu/repec/bocode/f/fvgen.sthlp help file (text/plain)

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link: https://EconPapers.repec.org/RePEc:boc:bocode:s459957

Ordering information: This software item can be ordered from
http://repec.org/docs/ssc.php

Access Statistics for this software item

More software in Statistical Software Components from Boston College Department of Economics Boston College, 140 Commonwealth Avenue, Chestnut Hill MA 02467 USA. Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().

 
Page updated 2026-10-31
Handle: RePEc:boc:bocode:s459957