Stata 15 help for fvset

[R] fvset -- Declare factor-variable settings

Syntax

Declare base settings

fvset base base_spec varlist

Declare design settings

fvset design design_spec varlist

Clear the current settings

fvset clear varlist

Report the current settings

fvset report [varlist] [, base(base_spec) design(design_spec)]

base_spec Description ------------------------------------------------------------------------- default default base first lowest level value; the default last highest level value frequent most frequent level value none no base # nonnegative integer value -------------------------------------------------------------------------

design_spec Description ------------------------------------------------------------------------- default default design asbalanced accumulate using 1/k, k = number of levels asobserved accumulate using observed relative frequencies; the default -------------------------------------------------------------------------

Description

fvset base, fvset design, and fvset clear manage factor-variable settings, which identify the base level and specify how to accumulate statistics over levels. fvset base declares the base level for each specified variable; the default for factor variables without a declared base level is the lowest value. fvset design specifies how the margins command is to accumulate over the levels of a factor variable. fvset clear removes factor-variable settings for each variable in varlist. fvset clear _all removes all factor-variable settings from all variables.

fvset report reports the current factor-variable settings for each variable in varlist. fvset without arguments is a synonym for fvset report.

Options

base(base_spec) restricts fvset report to report only the factor-variable settings for variables with the specified base_spec.

design(design_spec) restricts fvset report to report only the factor-variable settings for variables with the specified design_spec.

Examples

Setup . sysuse auto

By default, the first level is assumed to be the base . regress mpg i.rep78

Set 2 as the base level for rep78 . fvset base 2 rep78 . regress mpg i.rep78

Set rep78 to have no base level, and fit a cell-means regression . fvset base none rep78 . regress mpg i.rep78, nocons

By default, margins assumes that factor variables are to be treated asobserved and accumulates a margin by using the observed relative frequencies of the factor levels or the sum of the weights if weights have been specified . regress mpg i.foreign . margins

Set foreign to always accumulate using equal relative frequencies . fvset design asbalanced foreign . regress mpg i.foreign . margins

Report all the variables with the frequent base setting . fvset report, base(frequent)

Report all the variables with the asbalanced design setting . fvset report, design(asbalanced)

Technical note: margins is aware of a factor variable's design setting only through the estimation results it is working with. The design setting is stored by the estimation command; thus changing the design setting between the estimation command and margins will have no effect. For example, the output from the following two calls to margins yields the same results. . fvset clear foreign . regress mpg i.foreign . margins . fvset design asbalanced foreign . margins

Stored results

fvset stores the following in r():

Macros r(varlist) varlist r(baselist) base setting for each variable in varlist r(designlist) design setting for each variable in varlist


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index