📄 regress.hlp
字号:
{smcl}
{* *! version 1.0.0 09jun2005}{...}
{cmd:help regress} {right:dialog: {bf:{dialog regress}}{space 18}}
{right:also see: {help regress postestimation} }
{right:{help regress postestimation ts}}
{hline}
{title:Title}
{p2colset 5 20 22 2}{...}
{p2col :{hi:[R] regress} {hline 2}}Linear regression{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 16 2}
{opt reg:ress} {depvar} [{indepvars}] {ifin} {weight}
[{cmd:,} {it:options}]
{synoptset 20 tabbed}{...}
{synopthdr}
{synoptline}
{syntab:Model}
{synopt :{opt noc:onstant}}suppress constant term{p_end}
{synopt :{opt h:ascons}}has user-supplied constant{p_end}
{synopt :{opt tsscons}}compute total sum of squares with constant;
seldom used{p_end}
{syntab:SE/Robust}
{synopt :{opth vce(vcetype)}}{it:vcetype} may be {opt r:obust}, {opt boot:strap}, or {opt jack:knife}{p_end}
{synopt :{opt r:obust}}synonym for {cmd:vce(robust)}{p_end}
{synopt :{opth cl:uster(varname)}}adjust standard errors for intragroup
correlation{p_end}
{synopt :{opt ms:e1}}force mean squared error to 1{p_end}
{synopt :{opt hc2}}use u^2_j/(1-h_jj) as observation's variance{p_end}
{synopt :{opt hc3}}use u^2_j/(1-h_jj)^2 as observation's variance{p_end}
{syntab:Reporting}
{synopt :{opt l:evel(#)}}set confidence level; default is {cmd:level(95)}{p_end}
{synopt :{opt b:eta}}report standardized beta coefficients{p_end}
{synopt :{opt ef:orm(string)}}report exponentiated coefficients and label as
{it:string}{p_end}
{synopt :{opt nohe:ader}}suppress the table header{p_end}
{synopt :{opt plus}}make table extendable{p_end}
{synopt :{opth dep:name(varname)}}substitute dependent variable name;
programmer's option{p_end}
{synoptline}
{p 4 6 2}
{it:depvar} and {it:indepvars} may contain
time-series operators; see {help varlist}.{p_end}
{p 4 6 2}
{cmd:bootstrap}, {cmd:by}, {cmd:jackknife}, {cmd:rolling}, {cmd:statsby},
{cmd:stepwise}, {cmd:svy}, and {cmd:xi} are allowed; see {help prefix}.{p_end}
{p 4 6 2}
{cmd:aweight}s, {cmd:fweight}s, {cmd:iweight}s, and {cmd:pweight}s are
allowed; see {help weight}.{p_end}
{p 4 6 2}
See {help regress postestimation} for additional capabilities and estimation
commands.{p_end}
{title:Description}
{pstd}
{cmd:regress} fits a model of {it:depvar} on {it:indepvars} using linear
regression.
{pstd}
Here is a short list of other regression commands that may be of
interest. See {help estimation commands} for a complete list.
{synoptset 16 tabbed}{...}
{synoptline}
{synopt :{helpb areg}}an easier way to fit regressions with many
dummy variables{p_end}
{synopt :{helpb arch}}regression models with ARCH errors{p_end}
{synopt :{helpb arima}}ARIMA models{p_end}
{synopt :{helpb boxcox}}Box-Cox regression models{p_end}
{synopt :{helpb cnreg}}censored-normal regression{p_end}
{synopt :{helpb cnsreg}}constrained linear regression{p_end}
{synopt :{helpb eivreg}}errors-in-variables regression{p_end}
{synopt :{helpb frontier}}stochastic frontier models{p_end}
{synopt :{helpb heckman}}Heckman selection model{p_end}
{synopt :{helpb intreg}}interval regression{p_end}
{synopt :{helpb ivreg}}instrumental variables (2SLS) regression{p_end}
{synopt :{helpb ivtobit}}tobit regression with endogenous variables{p_end}
{synopt :{helpb newey}}regression with Newey-West standard errors{p_end}
{synopt :{helpb qreg}}quantile (including median) regression{p_end}
{synopt :{helpb reg3}}three-stage least-squares (3SLS) regression{p_end}
{synopt :{helpb rreg}}a type of robust regression{p_end}
{synopt :{helpb sureg}}seemingly unrelated regression{p_end}
{synopt :{helpb "svy: heckman"}}Heckman selection model with survey data{p_end}
{synopt :{helpb "svy: intreg"}}interval regression with survey data{p_end}
{synopt :{helpb "svy: ivreg"}}instrumental variables regression with survey data{p_end}
{synopt :{helpb "svy: regress"}}linear regression with survey data{p_end}
{synopt :{helpb tobit}}tobit regression{p_end}
{synopt :{helpb treatreg}}treatment-effects model{p_end}
{synopt :{helpb truncreg}}truncated regression{p_end}
{synopt :{helpb xtabond}}Arellano-Bond linear, dynamic panel-data estimator{p_end}
{synopt :{helpb xtfrontier}}panel-data stochastic frontier model{p_end}
{synopt :{helpb xtgls}}panel-data GLS models{p_end}
{synopt :{helpb xthtaylor}}Hausmann-Taylor estimator for error components
models{p_end}
{synopt :{helpb xtintreg}}panel-data interval regression models{p_end}
{synopt :{helpb xtivreg}}panel-data instrumental variables (2SLS)
regression{p_end}
{synopt :{helpb xtpcse}}OLS or Prais-Winsten models with panel-corrected
standard errors{p_end}
{synopt :{helpb xtreg}}fixed- and random-effects linear models{p_end}
{synopt :{helpb xtregar}}fixed- and random-effects linear models with an AR(1) disturbance{p_end}
{synopt :{helpb xttobit}}panel-data tobit models{p_end}
{synoptline}
{p2colreset}{...}
{title:Options}
{dlgtab:Model}
{phang}
{opt noconstant}; see {help estimation options##noconstant:estimation options}.
{phang}
{opt hascons} indicates that a user-defined constant or its equivalent
is specified among the independent variables in {varlist}. Some caution is
recommended when specifying this option, as resulting estimates may not be as
accurate as they otherwise would be. Use of this option requires "sweeping"
the constant last, so the moment matrix must be accumulated in absolute rather
than deviation form. This option may be safely specified when the means of
the dependent and independent variables are all "reasonable" and there are not
large amounts of collinearity between the independent variables. The best
procedure is to view {opt hascons} as a reporting option{hline 2}estimate with
and without {opt hascons} and verify that the coefficients and standard errors
of the variables not affected by the identity of the constant are unchanged.
{phang}
{opt tsscons} forces the total sum of squares to be computed as though
the model has a constant, that is, as deviations from the mean of the
dependent variable. This is a rarely used option that has an effect only when
specified with {opt noconstant}. It affects only the total sum of squares and
all results derived from the total sum of squares.
{dlgtab:SE/Robust}
{phang}
{opt vce(vcetype)}; see {it:{help vce_option}}.
{phang}
{opt robust}, {opth cluster(varname)}; see
{help estimation options##robust:estimation options}.
{opt cluster()} can be used with {cmd:pweight}s to produce estimates for
unstratified cluster-sampled data, but see {helpb "svy: regress"} for a command
especially designed for survey data.
{phang}
{opt mse1} is used only in programs and ado-files that employ {cmd:regress} to
fit models other than linear regression. {opt mse1} sets the mean squared
error to 1, forcing the variance-covariance matrix of the estimators to be
(X'DX)^-1 and affecting calculated standard errors. Degrees of freedom for t
statistics are calculated as n rather than n-k.
{phang}
{opt hc2} and {opt hc3} specify an alternate bias correction for the
{cmd:robust} variance calculation. {opt hc2} and {opt hc3} may not be
specified with {opt cluster()}. In the unclustered case, {opt robust} uses
sigma={n/(n-k)}u_j^2 as an estimate of the variance of the jth observation,
where u_j is the calculated residual and n/(n-k) is included to improve the
overall estimate's small-sample properties.
{pmore}
{opt hc2} instead uses u_j^2/(1-h_jj) as the observation's variance estimate,
where h_jj is the diagonal element of the hat (projection) matrix. This is
unbiased if the model really is homoskedastic. {opt hc2} tends to produce
slightly more conservative confidence intervals.
{pmore}
{opt hc3} uses u_j^2/(1-h_jj)^2 as suggested by Davidson and MacKinnon, who
report that this tends to produce better results when the model really is
heteroskedastic. {opt hc3} produces confidence intervals that tend to be even
more conservative.
{pmore}
{opt hc2} or {opt hc3} imply {opt robust}; typing {opt robust hc2}
(or {opt robust hc3}) is equivalent to typing {opt hc2} (or {opt hc3})
by itself.
{dlgtab:Reporting}
{phang}
{opt level(#)}; see {help estimation options##level():estimation options}.
{phang}
{opt beta} asks that standardized beta coefficients be reported instead of
confidence intervals. The {opt beta} coefficients are the regression
coefficients obtained by first standardizing all variables to have a mean of 0
and a standard deviation of 1. {opt beta} may not be specified with
{opt cluster()}.
{phang}
{opt eform(string)} is used only in programs and ado-files that employ
{cmd:regress} to fit models other than linear regression. {opt eform()}
specifies that the coefficient table be displayed in "exponentiated form" as
defined in {help maximize} and that {it:string} be used to label the
exponentiated coefficients in the table.
{phang}
{opt noheader} suppresses the display of the ANOVA table and summary
statistics at the top of the output; only the coefficient table is displayed.
This option is often used in programs and ado-files.
{phang}
{opt plus} specifies that the output table be made extendable. This option is
often used in programs and ado-files.
{phang}
{opth depname(varname)} is used only in programs and ado-files that employ
{cmd:regress} to fit models other than linear regression. {opt depname()} may
be specified only at estimation time. {it:varname} is recorded as the
identity of the dependent variable, even though the estimates are calculated
using {it:depvar}. This affects the labeling of the output{hline 2}not the
results calculated{hline 2}but could affect subsequent calculations made by
{cmd:predict}, where the residual would be calculated as deviations from
{it:varname} rather than {it:depvar}. {opt depname()} is most typically used
when {it:depvar} is a temporary variable (see {helpb macro}) used as a proxy
for {it:varname}.
{title:Examples: linear regression}
{phang}{cmd:. regress y x1 x2 x3 x4 x5}{p_end}
{phang}{cmd:. test x1 x2}{p_end}
{phang}{cmd:. test x3=5}{p_end}
{phang}{cmd:. test x3=(x4+x5)/2}{p_end}
{phang}{cmd:. predict yhat if e(sample)}{p_end}
{phang}{cmd:. predict r, resid}{p_end}
{phang}{cmd:. regress y x1 x2 x3 [freq=pop]}{p_end}
{phang}{cmd:. regress y x1 x2 x3 [pweight=pop]}{p_end}
{phang}{cmd:. regress yavg x1avg x2avg x3avg [aweight=pop]}{p_end}
{phang}{cmd:. regress y x1 x2 x3 x4 x5 if region==1}{p_end}
{phang}{cmd:. by region: regress y x1 x2 x3 x4 x5}{p_end}
{phang}{cmd:. by region: regress y x1 x2 x3 x4 s5 if sex=="male"}{p_end}
{title:Examples: regression with robust standard errors}
{phang}{cmd:. regress y x1 x2, robust}{p_end}
{phang}{cmd:. regress y x1 x2, robust cluster(patid)}{p_end}
{phang}{cmd:. regress y x1 x2 [pweight=pop], robust}{p_end}
{phang}{cmd:. regress y x1 x2 [pweight=pop]}{p_end}
{pstd}
(Note, specifying {cmd:pweight}s implies {cmd:robust}.)
{title:Also see}
{psee}
Manual: {bf:[R] regress}
{psee}
Online: {help regress postestimation}, {help regress postestimation ts};{break}
{helpb anova}, {helpb areg}, {helpb cnsreg}, {helpb heckman}, {helpb ivreg},
{helpb mvreg}, {helpb qreg},
{helpb reg3},
{helpb _robust},
{helpb rreg},
{helpb sureg},
{helpb "svy: regress"},
{helpb tobit},
{helpb truncreg},
{helpb xtgee}, {helpb xtgls}, {helpb xtintreg},
{helpb xtivreg}, {helpb xtpcse}, {helpb xtreg}, {helpb xtregar},
{helpb xttobit}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -