help cnsreg dialogs: cnsreg svy: cnsreg
also see: cnsreg postestimation
-------------------------------------------------------------------------------
Title
[R] cnsreg -- Constrained linear regression
Syntax
cnsreg depvar indepvars [if] [in] [weight] , constraints(constraints)
[options]
options description
-------------------------------------------------------------------------
Model
* constraints(constraints) apply specified linear constraints
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 spacing and display of omitted
variables and base and empty cells
+ mse1 force MSE to 1
+ coeflegend display coefficients' legend instead of
coefficient table
-------------------------------------------------------------------------
* constraints(constraints) is required.
+ mse1 and coeflegend do not appear in the dialog box.
indepvars may contain factor variables; see fvvarlist.
depvar and indepvars may contain time-series operators; see tsvarlist.
bootstrap, by, jackknife, mi estimate, rolling, statsby, and svy are
allowed; see prefix.
vce(bootstrap) and vce(jackknife) are not allowed with the mi estimate
prefix.
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, pweights, and iweights are allowed; see weight.
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. cnsreg typed without
arguments redisplays the previous cnsreg results.
Options
+-------+
----+ Model +------------------------------------------------------------
constraints(constraints), 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, that are
robust to some kinds of misspecification, that allow for intragroup
correlation, and that use bootstrap or jackknife methods; 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: noomitted, vsquish, noemptycells, baselevels,
allbaselevels; 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
. sysuse auto
. constraint 1 price = weight
. cnsreg mpg price weight, constraints(1)
. constraint 2 displ = weight
. constraint 3 gear_ratio = -foreign
. cnsreg mpg price weight displ gear_ratio foreign length, c(1-3)
. constraint 99 _cons = 0
. cnsreg mpg price weight displ gear_ratio foreign length, c(1-3,99)
Saved results
cnsreg saves the following in e():
Scalars
e(N) number of observations
e(k_autoCns) number of base, empty, and omitted constraints
e(df_m) model degrees of freedom
e(df_r) residual degrees of freedom
e(F) F statistic
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(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
Also see
Manual: [R] cnsreg
Help: [R] cnsreg postestimation;
[R] regress, [SVY] svy estimation