⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xtmixed.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 06apr2005}{...}
{cmd:help xtmixed} {right:dialog:  {bf:{dialog xtmixed}}{space 15}}
{right:also see:  {help xtmixed postestimation}}
{hline}

{title:Title}

{p2colset 5 21 23 2}{...}
{synopt :{hi:[XT] xtmixed} {hline 2}}Multilevel mixed-effects linear regression
{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 18 2}
{cmd:xtmixed} {depvar} [{it:fe_equation}] [{cmd:||} {it:re_equation}] 
	[{cmd:||} {it:re_equation} ...] 
	[{cmd:,} {it:{help xtmixed##options:options}}]

{p 4 4 2}
    and where the syntax of {it:fe_equation} is

{p 12 24 2}
	{indepvars} {ifin} [{cmd:,} {it:{help xtmixed##fe_options:fe_options}}]

{p 4 4 2}
    and the syntax of {it:re_equation} is one of:

{p 8 18 2}
	for random coefficients

{p 12 24 2}
	{it:{help varname:levelvar}}{cmd::} [{varlist}]
		[{cmd:,} {it:{help xtmixed##re_options:re_options}}]

{p 8 18 2}
	for a random effect among the levels of a factor variable

{p 12 24 2}
	{it:{help varname:levelvar}}{cmd::} {cmd:R.}{varname}
		[{cmd:,} {it:{help xtmixed##re_options:re_options}}]

{p 4 4 2}
    where {it:levelvar} is the grouping variable for the random effects
    at that level, or {cmd:_all} for the inclusive group comprised of all
    observations.{p_end}

{synoptset 23 tabbed}{...}
{marker fe_options}{...}
{synopthdr :fe_options}
{synoptline}
{syntab:Model}
{synopt :{opt noc:onstant}}suppress the constant from the fixed effects equation{p_end}
{synoptline}

{marker re_options}{...}
{synopthdr :re_options}
{synoptline}
{syntab:Model}
{synopt :{opt noc:onstant}}suppress the constant from the random effects 
equation{p_end}
{synopt :{opth cov:ariance(xtmixed##vartype:vartype)}}variance/covariance 
structure of the random effects{p_end}
{synoptline}

{marker options}{...}
{synopthdr :options}
{synoptline}
{syntab:Estimation}
{synopt:{opt reml}}fit model via maximum restricted likelihood, the 
default{p_end}
{synopt:{opt ml:e}}fit model via maximum likelihood{p_end}
{synopt :{opt nostd:err}}do not estimate standard errors of 
random-effects parameters{p_end}
{synopt :{opt nolr:test}}do not perform LR test comparing to linear 
regression{p_end}

{syntab :Reporting}
{synopt :{opt nohead:er}}suppress output header{p_end}
{synopt :{opt nogr:oup}}suppress table summarizing groups{p_end}
{synopt :{opt nofet:able}}suppress fixed-effects table{p_end}
{synopt :{opt noret:able}}suppress random-effects table{p_end}
{synopt :{opt var:iance}}show random-effects parameter estimates as 
variances/covariances{p_end}
{synopt :{opt estm:etric}}show parameter estimates in the estimation 
metric{p_end}
{synopt :{opt l:evel(#)}}set confidence level; default is {cmd:level(95)}{p_end}

{syntab :EM options}
{synopt :{opt emiter:ate(#)}}number of EM iterations, default is 20{p_end}
{synopt :{opt emtol:erance(#)}}EM convergence tolerance, default is 1e-10{p_end}
{synopt :{opt emonly}}fit model exclusively using EM{p_end}
{synopt :{opt emlog}}show EM iteration log{p_end}
{synopt :{opt emdot:s}}show EM iterations as dots{p_end}

{syntab :Max options}
{synopt :{it:{help maximize}}}control the maximization process; seldom 
used{p_end}
{synoptline}

{synoptset 23}{...}
{marker vartype}{...}
{synopthdr :vartype}
{synoptline}
{synopt :{opt ind:ependent}}one variance parameter per random effect, 
all covariances zero; the default unless a factor variable is specified{p_end}
{synopt :{opt ex:changeable}}equal variances for random effects, 
and one common pairwise covariance{p_end}
{synopt :{opt id:entity}}equal variances for random effects, all 
covariances zero; the default for factor variables{p_end}
{synopt :{opt un:structured}}all variances/covariances distinctly 
estimated{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}{cmd:bootstrap}, {cmd:by}, {cmd:jackknife}, {cmd:statsby}, 
{cmd:rolling}, and {cmd:xi} are allowed; see {help prefix}.{p_end}
{p 4 6 2}See {help xtmixed postestimation} for features available after 
estimation.{p_end}


{title:Description}

{pstd}
{cmd:xtmixed} fits linear mixed models.  Mixed models are characterized as
containing both {it:fixed effects} and {it:random effects}.  The fixed effects
are analogous to standard regression coefficients and are estimated directly.
The random effects are not directly estimated, but summarized according to
their estimated variances and covariances.  Random effects may take the form
of either random intercepts or random coefficients, and the grouping structure
of the data may consist of multiple levels of nested groups.  The error
distribution of the linear mixed model is assumed to be Gaussian.


{title:Options}

{dlgtab:Model}

{phang}{opt noconstant} suppresses the constant (intercept) term, and may
be specified for the fixed effects equation and for any or all of the random
effects equations.

{phang}{opt covariance(vartype)} specifies the structure of the (co)variance
matrix for the random effects, and may be specified for each random effects
equation.  An {cmd:independent} covariance structure allows for a distinct
variance for each random effect within a random effects equation, and 
assumes that all covariances are zero.  {cmd:exchangeable} covariances
have common variances and one common pairwise covariance.  {cmd:identity}
is short for "multiple of the identity."  That is, all variances are equal
and all covariances are zero.  {cmd:unstructured} covariances allow for
all variances and covariances to be distinct.  If an equation consists of
{it:p} random effects, the {cmd:unstructured} covariance matrix will have
{it:p}({it:p}+1)/2 parameters to be estimated.

{pmore}
{cmd:covariance(independent)} is the default, except for when the random
effects equation consists of the factor variable specification
{cmd:R.}{it:varname}, in which case {cmd:covariance(identity)} is the default
and only {cmd:covariance(identity)} and {cmd:covariance(exchangeable)} 
are allowed.

{dlgtab:Estimation}

{phang}
{opt reml}, the default, specifies that the model be fit using maximum 
restricted likelihood (REML), also referred to as maximum residual likelihood.

{phang}
{opt mle} specifies that the model be fit using maximum likelihood.

{phang}
{opt nostderr} prevents {cmd:xtmixed} from calculating standard errors for
the estimated random-effects parameters, although standard errors are still
given for the fixed-effects parameters.  Specifying this option will result
in faster computation times.  

{phang}
{opt nolrtest} prevents {cmd:xtmixed} from fitting a reference linear 
regression model and using this model to calculate a likelihood ratio 
test comparing the mixed model to ordinary regression.  This option may
also be specified upon replay to suppress this test from the output.

{dlgtab:Reporting}

{phang}
{opt noheader} suppresses the output header, either at estimation or 
upon replay.

{phang}
{opt nogroup} suppresses the display of group summary information (number of 
groups, average group size, minimum, and maximum) from the output header.

{phang}
{opt nofetable} suppresses the fixed-effects table from the output.

{phang}
{opt noretable} suppresses the random-effects table from the output.

{phang}
{opt variance} displays the random-effects parameter estimates as 
variances and covariances.  The default is to display them as standard
deviations and correlations.

{phang}
{opt estmetric} displays all parameter estimates in the estimation metric.
Fixed effects estimates are unchanged from those normally displayed, but 
random-effects parameter estimates are displayed as log-standard deviations
and hyperbolic arc-tangents of correlations, with equation names that 
organize them by level.

{phang}
{opt level(#)}; see {help estimation options}.

{dlgtab:EM options}

{phang}
{opt emiterate(#)} specifies the number of EM (Expectation-Maximization)
iterations to perform.  The default is 20.

{phang}
{opt emtolerance(#)} specifies the convergence tolerance for the EM 
algorithm.  The default is 1e-8.  EM iterations will be halted once the log
(restricted) likelihood changes by a relative amount less than {it:#}.  At that
point, maximum switches to a gradient-based method, unless {opt emonly} is
specified.

{phang}
{opt emonly} specifies that the likelihood be maximized exclusively using
EM.  The advantage of specifying {opt emonly} is that EM iterations are 
typically much faster than those for gradient-based methods.  The disadvantages
are that EM iterations can be slow to converge (if at all) and EM provides
no facility for estimating standard errors for the random-effects parameters.

{phang}
{opt emlog} specifies that the EM iteration log be shown.  The EM iteration 
log is, by default, not displayed unless option {opt emonly} is specified.

{phang}
{opt emdots} specifies that the EM iterations be shown as dots.  This can 
be convenient since the EM algorithm may require many iterations to converge.

{dlgtab:Max options}

{phang}
{it:maximize_options}:
{opt dif:ficult},
{opt tech:nique(algorithm_spec)},
{opt iter:ate(#)},
[{cmdab:no:}]{opt lo:g},
{opt tr:ace},
{opt hess:ian},
{opt grad:ient},
{opt showstep},
{opt tol:erance(#)},
{opt ltol:erance(#)},
{opt gtol:erance(#)},
{opt nrtol:erance(#)},
{opt nonrtol:erance}, 
{opt shownr:tolerance};
but those that require special mention for {cmd: xtmixed}
are listed below.

{phang}{opt technique(algorithm_spec)}; the default is {opt nr}.  
The {opt bhhh} algorithm may not be specified.


{title:Remarks on specifying random-effects equations}

{pstd}
Mixed models consist of fixed effects and random effects.  The fixed effects
are specified as regression parameters in a manner similar to most other Stata
estimation commands, that is, as a dependent variable followed by a set of
regressors.  The random-effects portion of the model is specified by first
considering the grouping structure of the data.  For example, if random
effects are to vary according to variable {cmd:school}, then the call to
{cmd:xtmixed} would be of the form

{p 8 12 4}{cmd:. xtmixed} {it:fixed_portion} 
{cmd:|| school:} ... {cmd:,}
{it:options}{p_end}

{pstd}
The variable lists that comprise each equation describe how the random effects
enter into the model, either as random intercepts (constant term) or as random
coefficients on regressors in the data.  One may also specify the
variance/covariance structure of the within-equation random effects, according
to the four available structures described above.  For example,

{p 8 12 4}{cmd:. xtmixed} {it:f_p}
{cmd:|| school: z1, covariance(unstructured)}
{it:options}{p_end}

{pstd}
will fit a model with a random intercept and random slope for variable 
{cmd:z1}, and treat the variance/covariance structure of these two 
random effects as unstructured.

{pstd}
If the data are organized by
a series of nested groups, for example, classes within schools, then the
random-effects structure is specified by a series of equations, each separated
by {cmd:||}.  The order of nesting proceeds from left to right.  For our
example, this would mean that an equation for schools would be specified
first, followed by an equation for classes.  As an example consider

{p 8 12 4}{cmd:. xtmixed} {it:f_p} 
{cmd:|| school: z1, cov(un) || class: z1 z2 z3, nocons cov(ex)} {it:options}

{pstd}
where variables {cmd:school} and {cmd:class} identify the schools and 
classes within schools, respectively.   This model contains a random 
intercept and random coefficient on {cmd:z1} at the school level, and random
coefficients on variables {cmd:z1}, {cmd:z2}, and {cmd:z3} at the 
class level.  The covariance structure for the random effects at the class
level is exchangeable, meaning that the random effects share a common 
variance and common pairwise covariance.

{pstd}
Group variables may be repeated, allowing for more general covariance
structures to be constructed as blocked-diagonal matrices based on the four
original structures.  Consider

{p 8 12 4}{cmd:. xtmixed} {it:f_p} 
{cmd:|| school: z1 z2, nocons cov(id) || school: z3 z4, nocons cov(un)}
{it:options}

{pstd}
which specifies four random coefficients at the school level.  The 
variance/covariance matrix of the random effects is the 4x4 matrix
where the upper 2x2 diagonal block is a multiple of the identity matrix, and 
the lower 2x2 diagonal block is unstructured.  In effect, the coefficients on
{cmd:z1} and {cmd:z2} are constrained to be independent and share a common
variance.  The coefficients on {cmd:z3} and {cmd:z4} each have a distinct
variance, and a variance distinct from that of the coefficients on {cmd:z1} and
{cmd:z2}.  They are also allowed to be correlated, yet they are independent
from the coefficients on {cmd:z1} and {cmd:z2}.

{pstd}
For mixed models with no nested grouping structure, it is convenient to 
think of the entire estimation data as a single group.  Toward this 
end, {cmd:xtmixed} allows the special group designation {cmd:_all}.  
{cmd:xtmixed} also allows the factor variable notation {cmd:R.}{it:varname}, 
which is shorthand for describing the levels of {it:varname} as a 
series of indicator variables.  See {bf:[XT] xtmixed} for more details.


{title:Examples}

{pstd}
Random intercept model, analogous to {cmd:xtreg}
{p_end}
{phang}
{cmd:. xtmixed ln_w grade age* ttl_exp tenure* || id:}
{p_end}

{pstd}
Random intercept and random slope (coefficient) model
{p_end}
{phang}
{cmd:. xtmixed ln_w grade age* ttl_exp tenure* || id: grade}
{p_end}

{pstd}
Random intercept and random slope (coefficient) model, correlated random
effects
{p_end}
{phang}
{cmd:. xtmixed ln_w grade age* ttl_exp tenure* || id: grade, cov(unstruct)}
{p_end}

{pstd}
One-way random-effects model
{p_end}
{phang}
{cmd:. xtmixed score || school:}
{p_end}

{pstd}
Two-level nested model, fit by maximum likelihood
{p_end}
{phang}
{cmd:. xtmixed score || school: || class:, mle}
{p_end}

{pstd}
Two-way crossed random effects
{p_end}
{phang}
{cmd:. xtmixed yield || _all: R.worker || _all: R.machine}
{p_end}


{title:Also see}

{psee}
Manual:  {bf:[XT] xtmixed}

{psee}
Online:  {help xtmixed postestimation};{break} {help estcom}, {help postest};
{helpb anova}, {helpb loneway}, {helpb oneway}, 
{helpb regress}, {helpb xtreg}, {helpb xtgee},
{helpb xtgls}, {helpb xi} 
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -