Stata 15 help for cnsreg

[R] cnsreg -- Constrained linear regression

Syntax

cnsreg depvar indepvars [if] [in] [weight] , constraints(constraints) [options]

options Description ------------------------------------------------------------------------- Model * constraints(constraints) apply specified linear constraints collinear keep collinear variables noconstant suppress constant term

SE/Robust vce(vcetype) vcetype may be ols, robust, cluster clustvar, bootstrap, or jackknife

Reporting level(#) set confidence level; default is level(95) nocnsreport do not display constraints display_options control columns and column formats, row spacing, line width, display of omitted variables and base and empty cells, and factor-variable labeling

mse1 force MSE to be 1 coeflegend display legend instead of statistics ------------------------------------------------------------------------- * constraints(constraints) is required. indepvars may contain factor variables; see fvvarlist. depvar and indepvars may contain time-series operators; see tsvarlist. bootstrap, by, fp, jackknife, mi estimate, rolling, statsby, and svy are allowed; see prefix. vce(bootstrap) and vce(jackknife) are not allowed with the mi estimate prefix. With the fp prefix, constraints cannot be specified for the variable containing fractional polynomial terms. Weights are not allowed with the bootstrap prefix. aweights are not allowed with the jackknife prefix. vce(), mse1, and weights are not allowed with the svy prefix. aweights, fweights, iweights, and pweights are allowed; see weight. mse1 and coeflegend do not appear in the dialog box. See [R] cnsreg postestimation for features available after estimation.

Menu

Statistics > Linear models and related > Constrained linear regression

Description

cnsreg fits constrained linear regression models.

Options

+-------+ ----+ Model +------------------------------------------------------------

constraints(constraints), collinear, noconstant; see [R] estimation options.

+-----------+ ----+ SE/Robust +--------------------------------------------------------

vce(vcetype) specifies the type of standard error reported, which includes types that are derived from asymptotic theory (ols), that are robust to some kinds of misspecification (robust), that allow for intragroup correlation (cluster clustvar), and that use bootstrap or jackknife methods (bootstrap, jackknife); see [R] vce_option.

vce(ols), the default, uses the standard variance estimator for ordinary least-squares regression.

+-----------+ ----+ Reporting +--------------------------------------------------------

level(#); see [R] estimation options.

nocnsreport; see [R] estimation options.

display_options: noci, nopvalues, noomitted, vsquish, noemptycells, baselevels, allbaselevels, nofvlabel, fvwrap(#), fvwrapon(style), cformat(%fmt), pformat(%fmt), sformat(%fmt), and nolstretch; see [R] estimation options.

The following options are available with cnsreg but are not shown in the dialog box:

mse1 is used only in programs and ado-files that use cnsreg to fit models other than constrained linear regression. mse1 sets the mean squared error to 1, thus forcing the variance-covariance matrix of the estimators to be (X'DX)^-1 (see Methods and formulas in [R] regress) and affecting calculated standard errors. Degrees of freedom for t statistics are calculated as n rather than n-p+c, where p is the total number of parameters (prior to restrictions and including the constant) and c is the number of constraints.

mse1 is not allowed with the svy prefix.

coeflegend; see [R] estimation options.

Examples

Setup . sysuse auto

Constrain coefficients of price and weight to be equal . constraint 1 price = weight

Fit constrained linear regression . cnsreg mpg price weight, constraints(1)

Define more constraints . constraint 2 displ = weight . constraint 3 gear_ratio = -foreign

Fit constrained linear regression, applying all three constraints . cnsreg mpg price weight displ gear_ratio foreign length, c(1-3)

Constrain constant to be zero . constraint 99 _cons = 0

Fit constrained linear regression, applying all four constraints . cnsreg mpg price weight displ gear_ratio foreign length, c(1-3,99)

Stored results

cnsreg stores the following in e():

Scalars e(N) number of observations e(df_m) model degrees of freedom e(df_r) residual degrees of freedom e(F) F statistic e(p) p-value for model test e(rmse) root mean squared error e(ll) log likelihood e(N_clust) number of clusters e(rank) rank of e(V)

Macros e(cmd) cnsreg e(cmdline) command as typed e(depvar) name of dependent variable e(wtype) weight type e(wexp) weight expression e(title) title in estimation output e(clustvar) name of cluster variable e(vce) vcetype specified in vce() e(vcetype) title used to label Std. Err. e(properties) b V e(predict) program used to implement predict e(marginsok) predictions allowed by margins e(asbalanced) factor variables fvset as asbalanced e(asobserved) factor variables fvset as asobserved

Matrices e(b) coefficient vector e(Cns) constraints matrix e(V) variance-covariance matrix of the estimators e(V_modelbased) model-based variance

Functions e(sample) marks estimation sample


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