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

📄 program_properties.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 10feb2005}{...}
{cmd:help program properties}
{hline}

{title:Title}

{p2colset 5 31 33 2}{...}
{p2col :{hi:[P] program properties} {hline 2}}Properties of user-defined programs{p_end}
{p2colreset}{...}


{title:Description}

{pstd}
User-defined programs can have properties associated with them.  Program
properties are used by some of Stata's prefix commands for command validation.
Program properties are associated with programs by using the {opt properties()}
option when they are {opt program} defined.

{p 8 25 2}
{cmdab:pr:ogram}
[{cmdab:de:fine}]
	{it:command}
	[{cmd:,}
		{opt prop:erties(namelist)}
		...]{p_end}
               {cmd://} {it:body of the program}

        {cmd:end}

{pstd}
You can retrieve program properties for {it:command} using the
{cmd:properties} exended macro function.

{p 8 24 2}
{cmdab:gl:obal} {it:mname} {cmd::} {cmd:properties} {it:command}

{p 8 24 2}
{cmdab:l:ocal} {it:lclname} {cmd::} {cmd:properties} {it:command}


{title:Option}

{phang}
{opt properties(namelist)} states that {it:command} has the specified
properties.  {it:namelist} may contain up to 80 characters, including
separating spaces.


{title:Remarks}

{bf:Writing programs for use with stepwise}

{pstd}
A subset of Stata's estimation commands can be used with the {helpb stepwise}
prefix.  For example, the syntax diagram for the {cmd:regress} command could
be presented as

{p 16 33 2}
[{cmd:stepwise,} ...{cmd::}]  {cmdab:reg:ress} ...

{pstd}In general, the syntax for the {cmd:stepwise} prefix is

{p 16 25 2}
{cmd:stepwise} [{cmd:,} {it:sw_options}]
	{cmd::} {it:command}
	{it:termlist}
	{ifin}
	[{cmd:,} {it:options}]

{pstd}where {it:termlist} is documented in {helpb stepwise}.

{pstd}
The following items detail how to write programs (ado-files) that can
be used with the {cmd:stepwise} prefix.  Some theoretical requirements
must be satisfied in order to justify using {cmd:stepwise} with a given
command; however, the following remarks are limited to the programming
requirements.

{phang}
1.  {it:command} must be an {cmd:eclass} command that accepts the
following estimation syntax; see {helpb program}, {helpb syntax}, and
{helpb mark}.

{p 16 24 2}
{it:command} {varlist} {ifin} {weight} [{cmd:,} {it:options}]

{phang}
2.  {it:command} must save the model coefficients and ancillary parameters in
{cmd:e(b)} and save the estimation sample size in {cmd:e(N)}, and
{cmd:e(sample)} must be set to identify the estimation sample; see
{helpb ereturn}.

{phang}
3.  For the likelihood-ratio test, {it:command} must have {cmd:swml} as a
property.  For example, the program definition for {cmd:poisson} looks
something like the following:

{p 16 34 2}
{cmd:program} {cmd:poisson,} {cmd:property(}... {cmd:swml} ...{cmd:)} ...

{pmore}
In addition, {it:command} must also save the log-likelihood value in
{cmd:e(ll)} and the model degrees of freedom in {cmd:e(df_m)}.

{phang}
4.  For the Wald test, {it:command} must have {cmd:sw} as a property if it
does not already have {cmd:swml} as a property.  For example, the program
definition for {cmd:ivreg} looks something like the following:

{p 16 31 2}
{cmd:program} {cmd:ivreg,} {cmd:property(}... {cmd:sw} ...{cmd:)} ...

{pmore}
In addition, {it:command} must save the variance estimates for the
coefficients and ancillary parameters in {cmd:e(V)}; see {helpb test}.


{bf:Writing programs for use with svy}

{pstd}
A subset of Stata's estimation commands can be used with the {helpb svy}
prefix.  For example, the syntax diagram for the {cmd:regress} command could
be presented as

{p 16 23 2}
[{cmd:svy:}]  {cmdab:reg:ress} ...

{pstd}
In general, the syntax for the {cmd:svy} prefix is

{p 16 20 2}
{cmd:svy} [{cmd:,} {it:svy_options}]
	{cmd::} {it:command}
	{varlist}
	{ifin}
	[{cmd:,} {it:options}]

{pstd}
The following items detail how to write programs (ado-files) that can
be used with the {cmd:svy} prefix.  The extra requirements imposed by the 
{cmd:svy} prefix command are due to the three variance-estimation methods it
employs: {cmd:vce(brr)}, {cmd:vce(jackknife)}, and {cmd:vce(linearized)}.
Each of these variance-estimation methods has theoretical requirements that
must be satisfied in order to justify using them with a given command;
however, the following remarks are limited to the programming requirements.

{phang}
1.  {it:command} must be an {cmd:eclass} command that allows {cmd:iweight}s
and accepts the following estimation syntax; see {helpb program},
{helpb syntax}, and {helpb mark}.

{p 16 24 2}
{it:command} {varlist} {ifin} {weight} [{cmd:,} {it:options}]

{phang}
2.  {it:command} must save the model coefficients and ancillary parameters in
{cmd:e(b)} and save the estimation sample size in {cmd:e(N)}, and
{cmd:e(sample)} must be set to identify the estimation sample; see
{helpb ereturn}.

{phang}
3.  {cmd:vce(brr)} requires that {it:command} have {cmd:svyb} as a property.
For example, the program definition for {cmd:regress} looks something like the
following:

{p 16 35 2}
{cmd:program} {cmd:regress,} {cmd:property(}... {cmd:svyb} ...{cmd:)} ...

{phang}
4.  {cmd:vce(jackknife)} requires that {it:command} have {cmd:svyj} as a
property.  For example, the program definition for {cmd:poisson} looks
something like the following:

{p 16 34 2}
{cmd:program} {cmd:poisson,} {cmd:property(}... {cmd:svyj} ...{cmd:)} ...

{phang}
5.  {cmd:vce(linearized)} has the following requirements:

{phang2}
a.  {it:command} must have {cmd:svyr} as a property.  For example, the program
definition for {cmd:logit} looks something like the following:

{p 16 31 2}
{cmd:program} {cmd:logit,} {cmd:property(}... {cmd:svyr} ...{cmd:)} ...

{phang2}
b.  {cmd:predict} after {it:command} must be able to generate scores using the
following syntax:

{p 16 24 2}
{cmd:predict} {dtype} {it:stub}* {ifin}{cmd:,} {opt sc:ores}

{pmore2}
This syntax implies that estimation results with k equations will cause 
{cmd:predict} to generate k new equation-level score variables.  These new
equation-level score variables are {it:stub}{cmd:_1} for the first equation,
{it:stub}{cmd:_2} for the second equation, ..., and {it:stub}{cmd:_}k
for the last equation.  Actually {cmd:svy} does not strictly require that
these new variables be named exactly this way, but this is a good convention
to follow.

{pmore2}
The equation-level score variables generated by {cmd:predict}  must be of the
form that can be used to estimate the variance using Taylor linearization
(otherwise known as the delta method); see {bf:[SVY] variance estimation}

{phang2}
c.  {it:command} must save the model-based variance estimator for the
coefficients and ancillary parameters in {cmd:e(V)}; see
{bf:[SVY] variance estimation}.

{pstd}
Note that all but a few of the above "requirements" are strictly enforced
for {cmd:svy} to work at all with a given command; otherwise, {cmd:svy}
will exit with an error message.  The requirements for {cmd:e(N)} and
{cmd:e(sample)} cannot be strictly enforced, so it is your responsibility to
certify that they are met.


{bf:Properties for exponentiating coefficients}

{pstd}
Stata has several prefix commands{hline 2}such as {cmd:bootstrap},
{cmd:jackknife}, and {cmd:svy}{hline 2}that employ alternative
variance-estimation techniques for existing commands.  These prefix commands
behave like conventional Stata estimation commands when reporting and saving
estimation results.  Given the appropriate properties, these prefix commands
can even report exponentiated coefficients.  In fact, the property names for
the various shortcuts for the {cmd:eform()} option are the same as the option
names.

{p2colset 9 28 30 2}{...}
{p2col :{it:option}/{it:property}}description{p_end}
{p2line}
{p2col :{cmd:hr}}hazard ratio{p_end}
{p2col :{cmd:irr}}incidence-rate ratio{p_end}
{p2col :{cmd:or}}odds ratio{p_end}
{p2col :{cmd:rrr}}relative risk ratio{p_end}
{p2line}
{p2colreset}{...}

{pstd}
For example, the program definition for {cmd:logit} looks something like the
following:

{p 8 22 2}
{cmd:program} {cmd:logit,} {cmd:property(}... {cmd:or} ...{cmd:)} ...


{bf:Checking for program properties}

{pstd}
You can use the {cmd:properties} extended macro function to check the
properties associated with a program; see {helpb macro}.  For example, the
following retrieves and displays the program properties for {cmd:logit}.

{phang2}{cmd:. local logitprops : properties logit}{p_end}
{phang2}{cmd:. di "`logitprops'"}{p_end}
{phang2}{result:or svyb svyj svyr swml}{p_end}


{title:Also see}

{psee}
Manual:  {bf:[P] program properties}

{psee}
Online:  {helpb stepwise}, {helpb svy}
{p_end}

⌨️ 快捷键说明

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