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

📄 glm.hlp

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

{title:Title}

{p2colset 5 16 18 2}{...}
{p2col :{hi:[R] glm} {hline 2}}Generalized linear models{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 12 2}
{cmd:glm}
{depvar}
[{indepvars}]
{ifin}
{weight}
[{cmd:,} {it:options}]

{synoptset 23 tabbed}{...}
{synopthdr}
{synoptline}
{syntab :Model}
{synopt :{opt f:amily(familyname)}}distribution of {depvar}; default is
{cmd:family(gaussian)}{p_end}
{synopt :{opt l:ink(linkname)}}link function; default is canonical link for
{opt family()} specified{p_end}

{syntab :Model 2}
{synopt :{opt nocon:stant}}suppress constant term{p_end}
{synopt :{opth exp:osure(varname)}}include ln({it:varname}) in model with
coefficient constrained to 1{p_end}
{synopt :{opth off:set(varname)}}include {it:varname} in model with coefficient
constrained to 1{p_end}
{synopt :{opth mu(varname)}}use {it:varname} as the initial estimate for the
mean of {depvar}{p_end}
{synopt :{opth ini:t(varname)}}synonym for {opt mu(varname)}{p_end}

{syntab :SE/Robust}
{synopt :{cmd:vce(}{help glm##vcetype:vcetype}{cmd:)}}{it:vcetype} may be
{opt oim}, {opt r:obust},
{opt opg}, {opt boot:strap}, {opt jack:knife}, {opt eim},
{opt jackknife1}, {opt hac}, or {opt unb:iased}{p_end}
{synopt :{opth t(varname)}}variable name corresponding to {opt t}{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 vf:actor(#)}}multiply variance matrix by scalar {it:#}{p_end}
{synopt :{opt disp(#)}}quasi-likelihood multiplier{p_end}
{synopt :{cmdab:sca:le(x2}|{cmd:dev}|{it:#}{cmd:)}}set the scale parameter{p_end}

{syntab :Reporting}
{synopt :{opt le:vel(#)}}set confidence level; default is
{cmd:level(95)}{p_end}
{synopt :{opt ef:orm}}report exponentiated coefficients{p_end}

{syntab :Max options}
{synopt :{opt irls}}use iterated, reweighted least-squares optimization of the
deviance{p_end}
{synopt :{it:{help glm##maximize_options:maximize_options}}}control the maximization process; seldom
used{p_end}
{synopt :{opt search}}search for good starting values{p_end}
{synopt :{opt fisher(#)}}use the Fisher scoring Hessian or expected information
matrix (EIM){p_end}

{p2coldent :+ {opt nohead:er}}suppress header table from above
coefficient table{p_end}
{p2coldent :+ {opt notable}}suppress coefficient table{p_end}
{p2coldent :+ {opt nodisplay}}suppress the output; iteration log is
still displayed{p_end}
{synoptline}
{p2colreset}{...}

{synoptset 23}{...}
{synopthdr :familyname}
{synoptline}
{synopt :{opt gau:ssian}}Gaussian (normal){p_end}
{synopt :{opt ig:aussian}}inverse Gaussian{p_end}
{synopt :{opt b:inormal}[{it:{help varname:varnameN}}|{it:#N}]}Bernoulli/binomial{p_end}
{synopt :{opt p:oisson}}Poisson{p_end}
{synopt :{opt nb:inormal}[{it:#k}]}negative binomial{p_end}
{synopt :{opt gam:ma}}gamma{p_end}
{synoptline}
{p2colreset}{...}

{synoptset 23}{...}
{synopthdr :linkname}
{synoptline}
{synopt :{opt i:dentity}}identity{p_end}
{synopt :{opt log}}log{p_end}
{synopt :{opt l:ogit}}logit{p_end}
{synopt :{opt p:robit}}probit{p_end}
{synopt :{opt c:loglog}}cloglog{p_end}
{synopt :{opt pow:er} {it:#}}power{p_end}
{synopt :{opt opo:wer} {it:#}}odds power{p_end}
{synopt :{opt nb:inomial}}negative binomial{p_end}
{synopt :{opt logl:og}}log-log{p_end}
{synopt :{opt logc}}log-complement{p_end}
{synoptline}
{p2colreset}{...}

{p 4 6 2}
+ {opt noheader}, {opt notable}, and {opt nodisplay} do not appear in the dialog box.{p_end}
{p 4 6 2}
{it:depvar} and {it:indepvars} may contain time-series operators; see {help tsvarlist}.{p_end}
{p 4 6 2}
{opt bootstrap}, {opt by}, {opt jackknife}, {opt rolling}, {opt statsby},
{opt stepwise}, and {opt xi} are allowed; see {help prefix}.{p_end}
{p 4 6 2}
{opt fweight}s, {opt aweight}s, {opt iweight}s, and {opt pweight}s are
allowed; see {help weight}.{p_end}
{p 4 6 2}
See {help glm postestimation}
for features available after estimation.{p_end}


{title:Description}

{pstd}
{opt glm} fits generalized linear models.  It can fit models using
either IRLS (maximum quasi-likelihood) or Newton-Raphson (maximum likelihood)
optimization, which is the default.  Previous versions of {cmd:glm} used only
IRLS.

{pstd}
See {help logistic estimation commands} for lists of related estimation
commands.


{title:Options}

{dlgtab:Model}

{phang}
{opt family(familyname)} specifies the distribution of
{depvar}; {cmd:family(gaussian)} is the default.

{phang}
{opt link(linkname)} specifies the link function; the
default is the canonical link for the {cmd:family()} specified.

{dlgtab:Model 2}

{phang}
{opt noconstant}, {opth exposure(varname)}, {opt offset(varname)};
see {help estimation options}.

{phang}
{opth mu(varname)} specifies {it:varname} as the initial estimate for the mean
of {depvar}.  This can be useful with models that experience convergence
difficulties, such as {cmd:family(binomial)} models with power or odds-power
links.  {opt init(varname)} is a synonym.

{marker vcetype}{...}
{dlgtab:SE/Robust}

{phang}
{opt vce(vcetype)}; see {it:{help vce_option}}.  In addition to the standard
{it:vcetype}s, {opt glm} allows the following alternatives.

{phang2}
{cmd:vce(eim)} specifies that the expected information matrix estimate of
variance be used.

{phang2}
{cmd:vce(jackknife1)} specifies that the one-step jackknife estimate of
variance be used.

{phang2}
{cmd:vce(hac} {it:kernel} [{it:#}]{cmd:)} specifies that a
heteroskedasticity- and autocorrelation-consistent (HAC) variance estimate be
used.  HAC refers to the general form for combining weighted matrices
to form the variance estimate.  There are three kernels built into
{opt glm}. {it:kernel} is a user-written program or one of

{center:{opt nw:est} | {opt ga:llant} | {opt an:derson}}

{pmore2}
If {it:#} is not specified, N - 2 is assumed.

{phang2}
{cmd:vce(unbiased)} specifies that the unbiased sandwich estimate of variance
be used.  This option implies the {opt robust} option.

{phang}
{opth t(varname)} specifies the variable name
corresponding to {cmd:t}; see {helpb tsset}.  {cmd:glm} does not need to
know {cmd:t()} in all cases, though it does if {cmd:vce(hac} ... {cmd:)} is
specified.  In that case, you can either specify the time variable with
{opt t()}, or you can {cmd:tsset} your data before calling {cmd:glm}.  When
the time variable is required, {cmd:glm} assumes that the observations are
spaced equally over time.

{phang}
{opt robust}, {opth cluster(varname)};
see {help estimation options}.

{phang}
{opt vfactor(#)} specifies a scalar by which to
multiply the resulting variance matrix.  This option allows you to match
output with other packages, which may apply degrees of freedom or other
small-sample corrections to estimates of variance.

{phang}
{opt disp(#)} multiplies the variance of {depvar}
by {it:#} and divides the deviance by {it:#}.  The resulting distributions are
members of the quasi-likelihood family.

{phang}
{cmd:scale(x2}|{cmd:dev}|{it:#}{cmd:)} overrides the
default scale parameter.  This option is only allowed with Hessian
(information matrix) variance estimates.

{pmore}
By default, {cmd:scale(1)} is assumed for
discrete distributions (binomial, Poisson, and negative binomial),
and {cmd:scale(x2)} is assumed for the continuous distributions
(Gaussian, gamma, and inverse Gaussian).

{pmore}
{cmd:scale(x2)} specifies the scale parameter be set to the Pearson
chi-squared (or generalized chi-squared) statistic divided by the residual
degrees of freedom.

{pmore}
{cmd:scale(dev)} sets the scale parameter to the deviance divided by the
residual degrees of freedom.  This provides an alternative to {cmd:scale(x2)}
for continuous distributions and overdispersed or underdispersed discrete
distributions.

{pmore}
{opt scale(#)} sets the scale parameter to {it:#}.
For example, using {cmd:scale(1)} in {cmd:family(gamma)} models results in
exponential-errors regression.  Additional use of {cmd:link(log)} rather than
the default {cmd:link(power -1)} for {cmd:family(gamma)} essentially
reproduces Stata's {opt streg}, {cmd:dist(exp) nohr} command (see
{helpb streg}) if all the observations are uncensored.

{dlgtab:Reporting}

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

{phang}
{opt eform} displays the exponentiated coefficients and corresponding
standard errors and confidence intervals.  For 
{cmd:family(binomial) link(logit)} (i.e., logistic regression),
 exponentiation results in odds ratios; for 
{cmd:family(poisson) link(log)} (i.e., Poisson regression),
 exponentiated coefficients are rate ratios.

{marker maximize_options}{...}
{dlgtab:Max options}

{phang}
{opt irls} requests iterated, reweighted least-squares (IRLS) optimization of
the deviance instead of Newton-Raphson optimization of the
log likelihood.  If the {opt irls} option is not specified, the optimization
is carried out using Stata's {opt ml} commands, in which case all options of
{opt ml maximize} are also available.

{phang}
{it:maximize_options}:
{opt dif:ficult},
{opt tech:nique(algorithm_spec)},
{opt iter:ate(#)},
[{cmdab:no:}]{opt lo:g},
{opt tr:ace},
{opt grad:ient},
{opt showstep},
{opt hess:ian},
{opt shownr:tolerance},
{opt tol:erance(#)},
{opt ltol:erance(#)},
{opt gtol:erance(#)},
{opt nrtol:erance(#)},
{opt nonrtol:erance},
{opt from(init_specs)}; see {help maximize}. These options are seldom used.

{phang}
{opt search} specifies that the command should search for good starting
values.  This option is only useful for Newton-Raphson optimization (and
not when {opt irls} is specified).

{phang}
{opt fisher(#)} specifies the number of Newton-Raphson steps that
should use the Fisher scoring Hessian or expected information matrix (EIM)
before switching to the observed information matrix (OIM).  This option is
only useful for Newton-Raphson optimization (and not when using {cmd:irls}).

{pstd}
The following options are available for {opt glm} but are not shown in the
dialog box:

{phang}
{opt noheader} suppresses the header information from the output.  The
coefficient table is still displayed.

{phang}
{opt notable} suppresses the table of coefficients from the output.  The
header information is still displayed.

{phang}
{opt nodisplay} suppresses the output.  The iteration log is still
displayed.


{title:Remarks}

{pstd}
Although {opt glm} can be used to fit linear regression
(and, in fact, does so by default), this should be viewed as an instructional
feature; {cmd:regress} produces such estimates more quickly, 
and numerous postestimation commands are available to explore the adequacy of
the fit; see {helpb regress} and {help regress postestimation}.

{pstd}
In any case, you should specify the link function using the {opt link()}
option and the distributional family using {opt family()}.
The available link functions are

{center:Link function            {cmd:glm} option     }
{center:{hline 40}}
{center:identity                 {cmd:link(identity)} }
{center:log                      {cmd:link(log)}      }
{center:logit                    {cmd:link(logit)}    }
{center:probit                   {cmd:link(probit)}   }
{center:complementary log-log    {cmd:link(cloglog)}  }
{center:odds power               {cmd:link(opower} {it:#}{cmd:)} }
{center:power                    {cmd:link(power} {it:#}{cmd:)}  }
{center:negative binomial        {cmd:link(nbinomial)}}
{center:log-log                  {cmd:link(loglog)}   }
{center:log-complement           {cmd:link(logc)}     }

{pstd}
The available distribution families are

{center:Family                 {cmd:glm} option       }
{center:{hline 40}}
{center:Gaussian(normal)       {cmd:family(gaussian)} }
{center:inverse Gaussian       {cmd:family(igaussian)}}
{center:Bernoulli/binomial     {cmd:family(binomial)} }
{center:Poisson                {cmd:family(poisson)}  }
{center:negative binomial      {cmd:family(nbinomial)}}
{center:gamma                  {cmd:family(gamma)}    }

{pstd}
You do not have to specify both {opt family()} and {opt link()}; the default
{opt link()} is the canonical link for the specified {opt family()}
(except for {opt nbinomial}):

{center:Family                  Default link{space 2}}
{center:{hline 38}}
{center:{cmd:family(gaussian)}        {cmd:link(identity)}}
{center:{cmd:family(igaussian)}       {cmd:link(power -2)}}
{center:{cmd:family(binomial)}        {cmd:link(logit)}   }
{center:{cmd:family(poisson)}         {cmd:link(log)}     }
{center:{cmd:family(nbinomial)}       {cmd:link(log)}     }
{center:{cmd:family(gamma)}           {cmd:link(power -1)}}

{pstd}
If you specify both {opt family()} and {opt link()}, note that not all
combinations make sense.  You may choose from the following combinations:

	  {c |} id  log  logit  probit  clog  pow  opower  nbinomial  loglog  logc
{hline 10}{c +}{hline 67}
Gaussian  {c |}  x   x                         x
inv. Gau. {c |}  x   x                         x
binomial  {c |}  x   x     x      x       x    x     x                  x      x
Poisson   {c |}  x   x                         x
neg. bin. {c |}  x   x                         x              x
gamma     {c |}  x   x                         x


{title:Examples}

{phang}{cmd:. glm low age lwt race2 race3 smoke ptl ht ui, f(bin) l(logit)}{p_end}
{phang}{cmd:. glm, eform}

{phang}{cmd:. glm dead ln_dose, family(binomial pop) link(logit)}{p_end}
{phang}{cmd:. glm dead ln_dose, family(binomial pop) link(cloglog)}{p_end}

{phang}{cmd:. xi: glm dead i.beetle ln_dose, f(bin pop) link(cl)}{p_end}
{phang}{cmd:. xi: glm dead i.beetle*ln_dose, f(bin pop) link(cl)}{p_end}
{phang}{cmd:. testparm I*}


{title:Also see}

{psee}
Manual:  {bf:[R] glm}

{psee}
Online:  {help glm postestimation};{break}
{helpb cloglog},
{helpb logistic},
{helpb nbreg},
{helpb poisson},
{helpb regress},
{help regress postestimation},
{helpb streg},
{helpb xtgee}
{p_end}

⌨️ 快捷键说明

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