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

📄 nl.hlp

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

{title:Title}

{p2colset 5 15 17 2}{...}
{p2col :{hi:[R] nl} {hline 2}}Nonlinear least-squares estimation{p_end}
{p2colreset}{...}


{title:Syntax}

{phang}
Interactive version
    
{p 8 11 2}
{opt nl} {cmd:(}{it:depvar}{cmd:=}<{it:sexp}>{cmd:)} {ifin} {weight} 
   [{cmd:,} {it:{help nl##options:options}}]
   
{phang}
Programmed substitutable expression version
    
{p 8 23 2}
{cmd:nl }{it:sexp_prog} {cmd::} {depvar} [{varlist}] {ifin}
   {weight} [{cmd:,} {it:{help nl##options:options}}]

{phang}
Function evaluator program version
    
{p 8 23 2}
{cmd:nl} {it:func_prog} {cmd:@} {depvar} [{varlist}] {ifin} {weight} {cmd:,}
   {c -(}{opt param:eters(namelist)}{c |}{opt nparam:eters(#)}{c )-} 
   [{it:{help nl##options:options}}]
   
{phang}
where

{phang2}
{it:depvar} is the dependent variable;{p_end}
{phang2}
{it:<sexp>} is a substitutable expression;{p_end}
{phang2}
{it:sexp_prog} is a substitutable expression program; and{p_end}
{phang2}
{it:func_prog} is a function evaluator program.

{synoptset 27 tabbed}{...}
{marker options}{...}
{synopthdr}
{synoptline}
{syntab :Model}
{synopt :{opth va:riables(varlist)}}variables in model{p_end}
{synopt :{opt in:itial(initial_values)}}initial values for parameters{p_end}
{p2coldent :* {opt param:eters(namelist)}}parameters in model (function evaluator program version only){p_end}
{p2coldent :* {opt nparam:eters(#)}}number of parameters in model (function evaluator program version only){p_end}
{synopt :{it:sexp_options}}options for substitutable expression program (programmed substitutable expression version only){p_end}
{synopt :{it:func_options}}options for function evaluator program (function evaluator program version only){p_end}

{syntab :Model 2}
{synopt :{opt ln:lsq(#)}}use log least squares where ln({it:depvar - #}) is assumed to be normally distributed{p_end}
{synopt :{opt noc:onstant}}indicate the model has no constant term; seldom used{p_end}
{synopt :{opt h:asconstant(name)}}identify constant term; seldom used{p_end}

{syntab :SE/Robust}
{synopt :{opt r:obust}}use Huber/White/sandwich estimator of variance{p_end}
{synopt :{cmd:hc2}}use a bias correction for {opt robust} covariance matrix{p_end}
{synopt :{cmd:hc3}}use an alternative bias correction for {opt robust} covariance matrix{p_end}
{synopt :{opth cl:uster(varname)}}observations are independent across groups specified by {it:varname}{p_end}

{syntab :Reporting}
{synopt :{opt l:evel(#)}}set confidence level; default is {cmd:level(95)}{p_end}
{synopt :{opt lea:ve}}generate variables containing derivative of E(y){p_end}
{synopt :{opt title(string)}}display {it:string} as title above the table of parameter estimates{p_end}
{synopt :{opt title2(string)}}display {it:string} as subtitle{p_end}

{syntab :Opt options}
{synopt :{it:{help nl##optimization_options:optimization_options}}}control the
optimization process; seldom used{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}* You must specify {opt parameters(namelist)} or {opt nparameters(#)}, or both.{p_end}
{p 4 6 2}{cmd:bootstrap}, {cmd:by}, {cmd:jackknife}, {cmd:rolling}, and
{cmd:statsby} are allowed; see {help prefix}.{p_end}
{p 4 6 2}{cmd:aweight}s, {cmd:fweight}s, and {cmd:iweight}s are allowed; see  
{help weight}.{p_end}
{p 4 6 2}See {help nl postestimation} for features available after estimation.


{title:Description}

{pstd}
{cmd:nl} fits an arbitrary nonlinear regression function by least squares.  With the 
interactive version of the command, you enter the function directly on the 
command line or the dialog box using a substitutable expression.  If you
have a function that you use regularly, you can write a substitutable
expression program and use the second syntax to avoid having to re-enter the
function every time.  The function evaluator program version gives you the
most flexibility in exchange for increased complexity; with this version, your
program is given a vector of parameters and a variable list, and your program
computes the regression function.

{pstd}
When you write a substitutable expression program or function evaluator 
program, the first two letters of the name must be {cmd:nl}.  {it:sexp_prog}
and {it:func_prog} refer to the name of the program without the first two
letters.  For example, if you wrote a function evaluator program named
{cmd:nlregss}, you would type {cmd:nl regss @ ...} to estimate the parameters.


{title:Options}

{dlgtab:Model}

{phang}
{opt variables(varlist)} specifies the variables in the model.  {opt nl}
ignores observations for which any of these variables have missing values.  If
you do not specify {opt variables()}, {cmd:nl} issues an error message with
return code 480 if the estimation sample contains any missing
values.

{phang}
{opt initial(initial_values)} specifies the initial values to begin the
estimation.  You can specify a 1 by k matrix, where k is the number of
parameters in the model, or you can specify a parameter name, its initial
value, another parameter name, its initial value, and so on.  For example, to
initialize {opt alpha} to 1.23 and {opt delta} to 4.57, you would type

{pmore2}
{cmd:nl ... , initial(alpha 1.23 delta 4.57)...}

{pmore}
Initial values declared using this option override any that are declared within
substitutable expressions.  If you specify a parameter that does not appear in
your model, {cmd:nl} exits with error code 480.  If you specify a matrix, the
values must be in the same order that the parameters are declared in your
model.  {cmd:nl} ignores the row and column names of the matrix.

{phang}
{opt parameters(namelist)} specifies the names of the parameters in the model.
The names of the parameters must adhere to the naming conventions of Stata's
variables; see {bind:{bf:[U] 11.3 Naming conventions}}.  If you specify both 
{opt parameters()} and {opt nparameters()}, the number of names in the former must
match the number specified in the latter; if not, {cmd:nl} issues an error
message with return code 198.

{phang}
{opt nparameters(#)} specifies the number of parameters in the model.  If you do
not specify names with the {opt parameters()} option, {cmd:nl} names them 
{cmd:b1}, {cmd:b2}, ..., {cmd:b}{it:#}.  If you specify both {opt parameters()} and 
{opt nparameters()}, the number of names in the former must match the number
specified in the latter; if not, {cmd:nl} issues an error message with return
code 198.

{phang}
{it:sexp_options} refer to any options allowed by your {it:sexp_prog}. 

{phang}
{it:func_options} refer to any options allowed by your {it:func_prog}.

{dlgtab:Model 2}

{phang}
{opt lnlsq(#)} fits the model using log least squares, which we define as
least squares with shifted lognormal errors. In other words,
ln({it:depvar}-{it:#}) is assumed to be normally distributed.  Sums of squares
and deviance are adjusted to the same scale as {it:depvar}.

{phang}
{opt noconstant} indicates that the function does not include a constant term.
This option is generally not needed, even if there is no constant term in the
model, unless the coefficient of variation (over observations) of the partial
derivative of the function with respect to a parameter is less than 
{opt eps()} and that parameter is not a constant term.

{phang}
{opt hasconstant(name)} indicates that parameter {it:name} be treated as
the constant term in the model and that {opt nl} should not use its algorithm
to find a constant term.  As with {opt noconstant}, this option is seldom used.

{dlgtab:SE/Robust}

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

{phang}
{opt hc2} and {opt hc3} specify alternative bias corrections for the 
{opt robust} variance calculation.  {opt hc2} and {opt hc3} may not be
specified with {opt cluster()}.  In the clustered case, {opt robust} uses
sigma_j^2 = {c -(}n/(n-k){c )-} u_j^2 as an estimate of the variance of
the j-th 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} uses u_j^2/(1-h_jj) as the observation's variance estimate,
where h_jj is the j-th diagonal element of the hat (projection) matrix.  This
produces an unbiased estimate of the covariance matrix if the model is 
homoskedastic.  {opt hc2} tends to produce slightly more conservative 
confidence intervals than {opt robust}.

{pmore}{opt hc3} uses u_j^2/(1-h_jj)^2 as the observation's variance 
estimate. {opt hc3} produces confidence intervals that tend to be even 
more conservative.

{pmore}Specifying either {opt hc2} or {opt hc3} implies {opt robust}.

{dlgtab:Reporting}

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

{phang}
{opt leave} leaves behind after estimation a set of new variables with
the same names as the estimated parameters containing the derivatives of E(y)
with respect to the parameters.  If the dataset contains an existing variable
with the same name as a parameter, then using {opt leave} causes {cmd:nl} to
issue an error message with return code 110.

{phang}
{opt title(string)} specifies an optional title that will be displayed just
above the table of parameter estimates.

{phang}
{opt title2(string)} specifies an optional subtitle that will be displayed
between the title specified in {opt title()} and the table of parameter
estimates.  If {opt title2()} is specified but {opt title()} is not, 
{opt title2()} has the same effect as {opt title()}.

{marker optimization_options}{...}
{dlgtab:Opt options}

{phang}
{it:optimization_options} control the iterative process that minimizes the 
    residual sum of squared errors.  These options are seldom used.

{phang2}
{opt nolog} prevents the iteration log from being shown.

{phang2}
{opt iterate(#)} specifies the maximum number of iterations.  When the number
    of iterations equals {it:#}, the optimizer stops and presents the
    current results, even if the convergence tolerance has not been reached.
    The default value of {opt iterate(#)} is the current value of 
    {helpb set maxiter}, which is {cmd:iterate(16000)} if {cmd:maxiter} has
    not been changed.

{phang2}
{opt eps(#)} specifies the convergence criterion for successive parameter
estimates and for the residual sum of squares.  The default is {cmd:eps(1e-5)}
(.00001).

{phang2}
{opt delta(#)} specifies the relative change in a parameter to be used in
computing the numeric derivatives.  The derivative for parameter b_i is
computed as {c -(}f(x,b_1,...,b_i + d) - f(x, b_1,..., b_i){c )-}/d 
where d is delta (b_i + delta).  The default is {cmd:delta(4e-7)}.

{phang2}
{opt tr:ace} adds to the iteration log a display of the current parameter
    vector.


{title:Substitutable expressions}

⌨️ 快捷键说明

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